Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make Autotest::RailsRspec2 honor spec/support/*.rb

Previously, it looked at a subdirectory called "shared," but the
generated spec_helper guides us towards one named "support" instead.

(Alternatively, we could have changed the generated spec_helper to
suggest "shared" instead, but since cucumber uses "features/support,"
this seems like a good choice.)

- Closes #233.
  • Loading branch information...
commit 3c290c07d29f3be597059e73e59817b8475073aa 1 parent 73051af
@matthewtodd matthewtodd authored dchelimsky committed
Showing with 33 additions and 14 deletions.
  1. +1 −1  lib/autotest/rails_rspec2.rb
  2. +32 −13 spec/autotest/rails_rspec2_spec.rb
View
2  lib/autotest/rails_rspec2.rb
@@ -71,7 +71,7 @@ def setup_rails_rspec2_mappings
add_mapping(%r%^config/database\.yml$%) { |_, m|
files_matching %r%^spec/models/.*_spec\.rb$%
}
- add_mapping(%r%^(spec/(spec_helper|shared/.*)|config/(boot|environment(s/test)?))\.rb$%) {
+ add_mapping(%r%^(spec/(spec_helper|support/.*)|config/(boot|environment(s/test)?))\.rb$%) {
files_matching %r%^spec/(models|controllers|routing|views|helpers)/.*_spec\.rb$%
}
add_mapping(%r%^lib/(.*)\.rb$%) { |_, m|
View
45 spec/autotest/rails_rspec2_spec.rb
@@ -2,24 +2,43 @@
require "autotest/rails_rspec2"
describe Autotest::RailsRspec2 do
- before(:each) do
- rails_rspec2_autotest = Autotest::RailsRspec2.new
- @re = rails_rspec2_autotest.exceptions
+ before do
+ @rails_rspec2_autotest = Autotest::RailsRspec2.new
end
- it "should match './log/test.log'" do
- @re.should match('./log/test.log')
- end
+ describe 'exceptions' do
+ before do
+ @re = @rails_rspec2_autotest.exceptions
+ end
- it "should match 'log/test.log'" do
- @re.should match('log/test.log')
- end
+ it "should match './log/test.log'" do
+ @re.should match('./log/test.log')
+ end
+
+ it "should match 'log/test.log'" do
+ @re.should match('log/test.log')
+ end
- it "should not match './spec/models/user_spec.rb'" do
- @re.should_not match('./spec/models/user_spec.rb')
+ it "should not match './spec/models/user_spec.rb'" do
+ @re.should_not match('./spec/models/user_spec.rb')
+ end
+
+ it "should not match 'spec/models/user_spec.rb'" do
+ @re.should_not match('spec/models/user_spec.rb')
+ end
end
- it "should not match 'spec/models/user_spec.rb'" do
- @re.should_not match('spec/models/user_spec.rb')
+ describe 'mappings' do
+ before do
+ @rails_rspec2_autotest.find_order = %w(
+ spec/models/user_spec.rb
+ spec/support/blueprints.rb
+ )
+ end
+
+ it 'runs model specs when support files change' do
+ @rails_rspec2_autotest.test_files_for('spec/support/blueprints.rb').should(
+ include('spec/models/user_spec.rb'))
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.