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
a49c0387
Commit
a49c0387
authored
May 26, 2014
by
cuong.tran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support "test/models" (since rails 4.0) in addition to "test/unit", #182
parent
d54e772a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
0 deletions
+26
-0
annotate_models.rb
lib/annotate/annotate_models.rb
+2
-0
common_validation.rb
spec/integration/common_validation.rb
+5
-0
task_test.rb
spec/integration/rails_4.1.1/test/models/task_test.rb
+19
-0
No files found.
lib/annotate/annotate_models.rb
View file @
a49c0387
...
...
@@ -10,6 +10,7 @@ module AnnotateModels
# File.join for windows reverse bar compat?
# I dont use windows, can`t test
UNIT_TEST_DIR
=
File
.
join
(
"test"
,
"unit"
)
MODEL_TEST_DIR
=
File
.
join
(
"test"
,
"models"
)
# since rails 4.0
SPEC_MODEL_DIR
=
File
.
join
(
"spec"
,
"models"
)
FIXTURE_TEST_DIR
=
File
.
join
(
"test"
,
"fixtures"
)
FIXTURE_SPEC_DIR
=
File
.
join
(
"spec"
,
"fixtures"
)
...
...
@@ -32,6 +33,7 @@ module AnnotateModels
TEST_PATTERNS
=
[
File
.
join
(
UNIT_TEST_DIR
,
"%MODEL_NAME%_test.rb"
),
File
.
join
(
MODEL_TEST_DIR
,
"%MODEL_NAME%_test.rb"
),
File
.
join
(
SPEC_MODEL_DIR
,
"%MODEL_NAME%_spec.rb"
),
]
...
...
spec/integration/common_validation.rb
View file @
a49c0387
...
...
@@ -38,6 +38,11 @@ module Annotate
File
.
read
(
"test/unit/task_test.rb"
).
should
==
unittest
end
def
self
.
check_task_modeltest
(
test_rig
,
annotation
,
place_before
=
true
)
unittest
=
apply_annotation
(
test_rig
,
"test/models/task_test.rb"
,
annotation
,
place_before
)
File
.
read
(
"test/models/task_test.rb"
).
should
==
unittest
end
def
self
.
check_task_factory
(
test_rig
,
annotation
,
place_before
=
true
)
fixture
=
apply_annotation
(
test_rig
,
"test/factories/tasks.rb"
,
annotation
,
place_before
)
File
.
read
(
"test/factories/tasks.rb"
).
should
==
fixture
...
...
spec/integration/rails_4.1.1/test/models/task_test.rb
0 → 100644
View file @
a49c0387
# == Schema Information
#
# Table name: tasks
#
# id :integer not null, primary key
# content :string(255)
# status :integer
# created_at :datetime
# updated_at :datetime
#
require
'test_helper'
class
TaskTest
<
ActiveSupport
::
TestCase
# Replace this with your real tests.
test
"the truth"
do
assert
true
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