diff --git a/lib/annotate/annotate_models.rb b/lib/annotate/annotate_models.rb index 008c49e33..3c5857021 100644 --- a/lib/annotate/annotate_models.rb +++ b/lib/annotate/annotate_models.rb @@ -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"), ] diff --git a/spec/integration/common_validation.rb b/spec/integration/common_validation.rb index 8beb19c09..c941a7f4c 100644 --- a/spec/integration/common_validation.rb +++ b/spec/integration/common_validation.rb @@ -38,6 +38,11 @@ def self.check_task_unittest(test_rig, annotation, place_before=true) 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 diff --git a/spec/integration/rails_4.1.1/test/models/task_test.rb b/spec/integration/rails_4.1.1/test/models/task_test.rb new file mode 100644 index 000000000..471c84194 --- /dev/null +++ b/spec/integration/rails_4.1.1/test/models/task_test.rb @@ -0,0 +1,19 @@ +# == 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