Permalink
Browse files

Refactored middleware spec

  • Loading branch information...
1 parent 35fd021 commit dc5bba7e56e9883372abce40c5b9af37fdf9bb74 @ayanko ayanko committed Jan 7, 2012
Showing with 22 additions and 37 deletions.
  1. +22 −37 spec/middleware_spec.rb
View
@@ -97,48 +97,33 @@
So I can write faster tests
) do
- context "with rack application and :rack_test driver", :driver => :rack_test do
- background do
- Capybara.app = TestRackApp
- Capybara.current_driver.should == :rack_test
- end
- include_examples "common scenarios"
- include_examples "rack scenarios"
- end
- context "with rack application and :selenium driver", :driver => :selenium do
- background do
- Capybara.app = TestRackApp
- Capybara.current_driver.should == :selenium
+ [:rack_test, :selenium].each do |driver_name|
+ context "with rack application and #{driver_name.inspect} driver", :driver => driver_name do
+ background do
+ Capybara.current_driver.should == driver_name
+ Capybara.app = TestRackApp
+ end
+ include_examples "common scenarios"
+ include_examples "rack scenarios"
end
- include_examples "common scenarios"
- include_examples "rack scenarios"
- end
- context "with sinatra application and :rack_test driver", :driver => :rack_test do
- background do
- Capybara.app = TestSinatraApp
- Capybara.current_driver.should == :rack_test
+ context "with sinatra application and #{driver_name.inspect} driver", :driver => driver_name do
+ background do
+ Capybara.current_driver.should == driver_name
+ Capybara.app = TestSinatraApp
+ end
+ include_examples "common scenarios"
+ include_examples "sinatra scenarios"
end
- include_examples "common scenarios"
- include_examples "sinatra scenarios"
- end
-
- context "with sinatra application and :selenium driver", :driver => :selenium do
- background do
- Capybara.app = TestSinatraApp
- Capybara.current_driver.should == :selenium
- end
- include_examples "common scenarios"
- include_examples "sinatra scenarios"
- end
- context "with rails application and :rack_test driver", :driver => :rack_test do
- background do
- Capybara.app = TestRailsApp::Application
- Capybara.current_driver.should == :rack_test
+ context "with rails application and #{driver_name.inspect} driver", :driver => driver_name do
+ background do
+ Capybara.current_driver.should == driver_name
+ Capybara.app = TestRailsApp::Application
+ end
+ include_examples "common scenarios"
+ include_examples "rails scenarios"
end
- include_examples "common scenarios"
- include_examples "rails scenarios"
end
end

0 comments on commit dc5bba7

Please sign in to comment.