Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

proper use of ActiveSupport::Concern

  • Loading branch information...
commit 84d448c4ce83138c8e3134e7ee732914acafa305 1 parent 5b6bea4
@dchelimsky dchelimsky authored
View
18 lib/rspec/rails/adapters.rb
@@ -4,21 +4,25 @@
module RSpec
module Rails
module SetupAndTeardownAdapter
- def setup(*methods)
- methods.each {|method| before { send method } }
- end
+ extend ActiveSupport::Concern
+
+ module ClassMethods
+ def setup(*methods)
+ methods.each {|method| before { send method } }
+ end
- def teardown(*methods)
- methods.each {|method| after { send method } }
+ def teardown(*methods)
+ methods.each {|method| after { send method } }
+ end
end
end
module TestUnitAssertionAdapter
extend ActiveSupport::Concern
- included do
- include Test::Unit::Assertions
+ include Test::Unit::Assertions
+ included do
before do
@_result = Struct.new(:add_assertion).new
end
View
27 lib/rspec/rails/example/controller_example_group.rb
@@ -4,26 +4,23 @@
module ControllerExampleGroupBehaviour
extend ActiveSupport::Concern
- module AttributeReaders
- extend ActiveSupport::Concern
- attr_reader :controller
+ include RSpec::Rails::SetupAndTeardownAdapter
+ include RSpec::Rails::TestUnitAssertionAdapter
+ include ActionController::TestCase::Behavior
+ include RSpec::Rails::ViewRendering
+ include Webrat::Matchers
+ include Webrat::Methods
+ include RSpec::Matchers
- module ClassMethods
- def controller_class
- describes
- end
+ attr_reader :controller
+
+ module ClassMethods
+ def controller_class
+ describes
end
end
included do
- extend RSpec::Rails::SetupAndTeardownAdapter
- include RSpec::Rails::TestUnitAssertionAdapter
- include ActionController::TestCase::Behavior
- include AttributeReaders
- include RSpec::Rails::ViewRendering
- include Webrat::Matchers
- include Webrat::Methods
- include RSpec::Matchers
before do
@routes = ::Rails.application.routes
ActionController::Base.allow_forgery_protection = false
View
12 lib/rspec/rails/example/request_example_group.rb
@@ -3,15 +3,15 @@
module RequestExampleGroupBehaviour
extend ActiveSupport::Concern
+
include ActionDispatch::Integration::Runner
+ include RSpec::Rails::TestUnitAssertionAdapter
+ include ActionDispatch::Assertions
+ include Webrat::Matchers
+ include Webrat::Methods
+ include RSpec::Matchers
included do
- include RSpec::Rails::TestUnitAssertionAdapter
- include ActionDispatch::Assertions
- include Webrat::Matchers
- include Webrat::Methods
- include RSpec::Matchers
-
before do
@router = ::Rails.application.routes
end
Please sign in to comment.
Something went wrong with that request. Please try again.