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
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
annotate_models.rb
lib/annotate/annotate_models.rb
+8
-4
No files found.
lib/annotate/annotate_models.rb
View file @
f209a163
...
...
@@ -168,8 +168,8 @@ module AnnotateModels
unless
ENV
[
'exclude_tests'
]
[
File
.
join
(
UNIT_TEST_DIR
,
"
#{
model_name
}
_test.rb"
),
# test
File
.
join
(
SPEC_MODEL_DIR
,
"
#{
model_name
}
_spec.rb"
),
# spec
find_test_file
(
UNIT_TEST_DIR
,
"
#{
model_name
}
_test.rb"
),
# test
find_test_file
(
SPEC_MODEL_DIR
,
"
#{
model_name
}
_spec.rb"
),
# spec
].
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
annotate_one_file
(
file
,
info
,
options_with_position
(
options
,
:position_in_fixture
))
...
...
@@ -306,8 +306,8 @@ module AnnotateModels
remove_annotation_of_file
(
fixture_file_name
)
if
File
.
exist?
(
fixture_file_name
)
end
[
File
.
join
(
UNIT_TEST_DIR
,
"
#{
klass
.
name
.
underscore
}
_test.rb"
),
File
.
join
(
SPEC_MODEL_DIR
,
"
#{
klass
.
name
.
underscore
}
_spec.rb"
)].
each
do
|
file
|
[
find_test_file
(
UNIT_TEST_DIR
,
"
#{
klass
.
name
.
underscore
}
_test.rb"
),
find_test_file
(
SPEC_MODEL_DIR
,
"
#{
klass
.
name
.
underscore
}
_spec.rb"
)].
each
do
|
file
|
remove_annotation_of_file
(
file
)
if
File
.
exist?
(
file
)
end
...
...
@@ -318,6 +318,10 @@ module AnnotateModels
end
puts
"Removed annotation from:
#{
deannotated
.
join
(
', '
)
}
"
end
def
find_test_file
(
dir
,
file_name
)
Dir
.
glob
(
File
.
join
(
dir
,
"**"
,
file_name
)).
first
||
File
.
join
(
dir
,
file_name
)
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