Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
annotate
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
annotate
Commits
f209a163
Commit
f209a163
authored
Nov 09, 2011
by
Christian Eichhorn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* Annotate unit tests in subfolders
parent
8b33b7d9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
annotate_models.rb
lib/annotate/annotate_models.rb
+9
-5
No files found.
lib/annotate/annotate_models.rb
View file @
f209a163
...
@@ -168,9 +168,9 @@ module AnnotateModels
...
@@ -168,9 +168,9 @@ module AnnotateModels
unless
ENV
[
'exclude_tests'
]
unless
ENV
[
'exclude_tests'
]
[
[
File
.
join
(
UNIT_TEST_DIR
,
"
#{
model_name
}
_test.rb"
),
# test
find_test_file
(
UNIT_TEST_DIR
,
"
#{
model_name
}
_test.rb"
),
# test
File
.
join
(
SPEC_MODEL_DIR
,
"
#{
model_name
}
_spec.rb"
),
# spec
find_test_file
(
SPEC_MODEL_DIR
,
"
#{
model_name
}
_spec.rb"
),
# spec
].
each
do
|
file
|
].
each
do
|
file
|
# todo: add an option "position_in_test" -- or maybe just ask if anyone ever wants different positions for model vs. test vs. fixture
# todo: add an option "position_in_test" -- or maybe just ask if anyone ever wants different positions for model vs. test vs. fixture
annotate_one_file
(
file
,
info
,
options_with_position
(
options
,
:position_in_fixture
))
annotate_one_file
(
file
,
info
,
options_with_position
(
options
,
:position_in_fixture
))
end
end
...
@@ -306,8 +306,8 @@ module AnnotateModels
...
@@ -306,8 +306,8 @@ module AnnotateModels
remove_annotation_of_file
(
fixture_file_name
)
if
File
.
exist?
(
fixture_file_name
)
remove_annotation_of_file
(
fixture_file_name
)
if
File
.
exist?
(
fixture_file_name
)
end
end
[
File
.
join
(
UNIT_TEST_DIR
,
"
#{
klass
.
name
.
underscore
}
_test.rb"
),
[
find_test_file
(
UNIT_TEST_DIR
,
"
#{
klass
.
name
.
underscore
}
_test.rb"
),
File
.
join
(
SPEC_MODEL_DIR
,
"
#{
klass
.
name
.
underscore
}
_spec.rb"
)].
each
do
|
file
|
find_test_file
(
SPEC_MODEL_DIR
,
"
#{
klass
.
name
.
underscore
}
_spec.rb"
)].
each
do
|
file
|
remove_annotation_of_file
(
file
)
if
File
.
exist?
(
file
)
remove_annotation_of_file
(
file
)
if
File
.
exist?
(
file
)
end
end
...
@@ -318,6 +318,10 @@ module AnnotateModels
...
@@ -318,6 +318,10 @@ module AnnotateModels
end
end
puts
"Removed annotation from:
#{
deannotated
.
join
(
', '
)
}
"
puts
"Removed annotation from:
#{
deannotated
.
join
(
', '
)
}
"
end
end
def
find_test_file
(
dir
,
file_name
)
Dir
.
glob
(
File
.
join
(
dir
,
"**"
,
file_name
)).
first
||
File
.
join
(
dir
,
file_name
)
end
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment