Permalink
Browse files

convert matchers to updated Matcher DSL

  • Loading branch information...
1 parent c2a0fcb commit bb1b3892cce487df4e704830e02160db3926dbef @dchelimsky dchelimsky committed Mar 19, 2010
@@ -14,7 +14,7 @@ module ControllerExampleGroupBehaviour
include ActionDispatch::Integration::Runner
include Webrat::Matchers
include Webrat::Methods
- include Rspec::Rails::Matchers
+ include Rspec::Matchers
def self.setup(*args); end
def self.teardown(*args); end
@@ -6,7 +6,7 @@ module RequestExampleGroupBehaviour
include ActionDispatch::Integration::Runner
include Webrat::Matchers
include Webrat::Methods
- include Rspec::Rails::Matchers
+ include Rspec::Matchers
def self.included(mod)
mod.before do
@@ -11,30 +11,15 @@ class AssertionFailedError < StandardError
end
end
-module Rspec
- module Rails
- module Matchers
- include Rspec::Matchers
-
- def redirect_to(destination)
- running_example = self
- Matcher.new :redirect_to, destination do |destination_|
- match_unless_raises Test::Unit::AssertionFailedError do |_|
- running_example.assert_redirected_to destination_
- end
- end
- end
-
- def render_template(options={}, message=nil)
- running_example = self
- Matcher.new :render_template, options, message do |options_, message_|
- match_unless_raises Test::Unit::AssertionFailedError do |_|
- running_example.assert_template options_, message_
- end
- end
- end
+Rspec::Matchers.define :redirect_to do |destination|
+ match_unless_raises Test::Unit::AssertionFailedError do |_|
+ assert_redirected_to destination
+ end
+end
- end
+Rspec::Matchers.define :render_template do |options, message|
+ match_unless_raises Test::Unit::AssertionFailedError do |_|
+ assert_template options, message
end
end

0 comments on commit bb1b389

Please sign in to comment.