Skip to content
Browse files

Wrap SetupAndTeardownAdapter, TestUnitAssertionAdapter and

RSpec::Matchers in a module that gets included in every type of example
group.
  • Loading branch information...
1 parent 6716c8b commit 1c5158e4358cf4895b60fe7d5c264f5d69c27ccb @dchelimsky dchelimsky committed Jul 31, 2010
View
1 lib/rspec/rails/example.rb
@@ -1,3 +1,4 @@
+require 'rspec/rails/example/rails_example_group'
require 'rspec/rails/example/controller_example_group'
require 'rspec/rails/example/request_example_group'
require 'rspec/rails/example/helper_example_group'
View
17 lib/rspec/rails/example/controller_example_group.rb
@@ -74,17 +74,24 @@ module ControllerExampleGroup
extend ActiveSupport::Concern
extend RSpec::Rails::ModuleInclusion
- include RSpec::Rails::SetupAndTeardownAdapter
- include RSpec::Rails::TestUnitAssertionAdapter
+ include RSpec::Rails::RailsExampleGroup
+
include ActionController::TestCase::Behavior
include RSpec::Rails::ViewRendering
- include Webrat::Methods
- include Webrat::Matchers
- include RSpec::Matchers
include RSpec::Rails::Matchers::RedirectTo
include RSpec::Rails::Matchers::RenderTemplate
include RSpec::Rails::Matchers::RoutingMatchers
+ include Webrat::Methods
+ include Webrat::Matchers
+
+ # TODO (DC 7/31/2010) this is already included in RailsExampleGroup, but
+ # due to some load order dependency problem between Webrat::Matchers and
+ # RSpec::Matchers, combined with the fact that RailsExampleGroup extends
+ # ActiveSupport::Concern, while the matcher modules do not, this needs to
+ # be here as well. At least for now.
+ include RSpec::Matchers
+
module ClassMethods
def controller_class
describes
View
4 lib/rspec/rails/example/helper_example_group.rb
@@ -29,8 +29,8 @@ module HelperExampleGroup
extend ActiveSupport::Concern
extend RSpec::Rails::ModuleInclusion
- include RSpec::Rails::SetupAndTeardownAdapter
- include RSpec::Rails::TestUnitAssertionAdapter
+ include RSpec::Rails::RailsExampleGroup
+
include ActionView::TestCase::Behavior
include RSpec::Rails::ViewAssigns
include Webrat::Matchers
View
4 lib/rspec/rails/example/mailer_example_group.rb
@@ -4,10 +4,10 @@ module MailerExampleGroup
extend ActiveSupport::Concern
extend RSpec::Rails::ModuleInclusion
- include RSpec::Rails::SetupAndTeardownAdapter
+ include RSpec::Rails::RailsExampleGroup
+
include ActionMailer::TestCase::Behavior
include Webrat::Matchers
- include RSpec::Matchers
included do
metadata[:type] = :mailer
View
2 lib/rspec/rails/example/model_example_group.rb
@@ -3,7 +3,7 @@ module ModelExampleGroup
extend ActiveSupport::Concern
extend RSpec::Rails::ModuleInclusion
- include RSpec::Matchers
+ include RSpec::Rails::RailsExampleGroup
included do
metadata[:type] = :model
View
11 lib/rspec/rails/example/rails_example_group.rb
@@ -0,0 +1,11 @@
+module RSpec
+ module Rails
+ module RailsExampleGroup
+ extend ActiveSupport::Concern
+
+ include RSpec::Rails::SetupAndTeardownAdapter
+ include RSpec::Rails::TestUnitAssertionAdapter
+ include RSpec::Matchers
+ end
+ end
+end
View
5 lib/rspec/rails/example/request_example_group.rb
@@ -15,13 +15,12 @@ module RequestExampleGroup
extend ActiveSupport::Concern
extend RSpec::Rails::ModuleInclusion
+ include RSpec::Rails::RailsExampleGroup
+
include ActionDispatch::Integration::Runner
- include RSpec::Rails::SetupAndTeardownAdapter
- include RSpec::Rails::TestUnitAssertionAdapter
include ActionDispatch::Assertions
include Webrat::Matchers
include Webrat::Methods
- include RSpec::Matchers
include RSpec::Rails::Matchers::RedirectTo
include RSpec::Rails::Matchers::RenderTemplate
include ActionController::TemplateAssertions
View
3 lib/rspec/rails/example/routing_example_group.rb
@@ -5,7 +5,8 @@ module RoutingExampleGroup
extend ActiveSupport::Concern
extend RSpec::Rails::ModuleInclusion
- include RSpec::Rails::TestUnitAssertionAdapter
+ include RSpec::Rails::RailsExampleGroup
+
include ActionDispatch::Assertions::RoutingAssertions
include RSpec::Rails::Matchers::RoutingMatchers
View
5 lib/rspec/rails/example/view_example_group.rb
@@ -21,12 +21,11 @@ module ViewExampleGroup
extend ActiveSupport::Concern
extend RSpec::Rails::ModuleInclusion
- include RSpec::Rails::SetupAndTeardownAdapter
- include RSpec::Rails::TestUnitAssertionAdapter
+ include RSpec::Rails::RailsExampleGroup
include ActionView::TestCase::Behavior
include RSpec::Rails::ViewAssigns
- include Webrat::Matchers
include RSpec::Rails::Matchers::RenderTemplate
+ include Webrat::Matchers
module ClassMethods
def _default_helper

0 comments on commit 1c5158e

Please sign in to comment.
Something went wrong with that request. Please try again.