Permalink
Browse files

clean up RequestExampleGroupBehaviour

  • Loading branch information...
1 parent a92d898 commit 17ee47cc330aa233775f477dc5ea54f85f5c1ebf @dchelimsky dchelimsky committed Apr 26, 2010
@@ -1,24 +1,27 @@
require 'active_support/concern'
require 'test/unit/assertions'
-module Rspec::Rails
- module SetupAndTeardownAdapter
- def setup(*methods)
- methods.each {|method| before { send method } }
- end
+module Rspec
+ module Rails
+ module SetupAndTeardownAdapter
+ 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
+ module TestUnitAssertionAdapter
+ extend ActiveSupport::Concern
+
+ included do
+ include Test::Unit::Assertions
- included do
- include Test::Unit::Assertions
- before do
- @_result = Struct.new(:add_assertion).new
+ before do
+ @_result = Struct.new(:add_assertion).new
+ end
end
end
end
@@ -1,4 +1,3 @@
-require 'active_support/core_ext/class/attribute_accessors'
require 'action_controller'
require 'webrat'
@@ -20,7 +19,7 @@ def controller_class
include Webrat::Methods
include Rspec::Matchers
before do
- @routes = Rails.application.routes
+ @routes = ::Rails.application.routes
ActionController::Base.allow_forgery_protection = false
end
end
@@ -2,15 +2,17 @@
require 'webrat'
module RequestExampleGroupBehaviour
- include ActionDispatch::Assertions
+ extend ActiveSupport::Concern
include ActionDispatch::Integration::Runner
- include Webrat::Matchers
- include Webrat::Methods
- include Rspec::Matchers
- def self.included(mod)
- mod.before do
- @_result = Struct.new(:add_assertion).new
+ 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
end
@@ -19,14 +21,14 @@ def app
::Rails.application
end
- Webrat.configure do |config|
- config.mode = :rack
- end
-
def last_response
response
end
+ Webrat.configure do |config|
+ config.mode = :rack
+ end
+
Rspec.configure do |c|
c.include self, :example_group => { :file_path => /\bspec\/requests\// }
end

0 comments on commit 17ee47c

Please sign in to comment.