Permalink
Browse files

Merge pull request #909 from rspec/route_to_matcher_failure_descripti…

…on_master

Failure message for should_not route_to properly includes expected options
  • Loading branch information...
2 parents 51c0871 + e8d3544 commit 525ed7acac51c81a7f5a5f1a399f658280692766 @alindeman alindeman committed Jan 5, 2014
Showing with 5 additions and 1 deletion.
  1. +4 −0 lib/rspec/rails/matchers/routing_matchers.rb
  2. +1 −1 spec/rspec/rails/matchers/route_to_spec.rb
@@ -35,6 +35,10 @@ def failure_message
rescued_exception.message
end
+ def failure_message_when_negated
+ "expected #{@actual.inspect} not to route to #{@expected.inspect}"
+ end
+
def description
"route #{@actual.inspect} to #{@expected.inspect}"
end
@@ -102,7 +102,7 @@ def assert_recognizes(*)
it "fails with custom message" do
expect do
expect({:get => "path"}).not_to route_to("these" => "options")
- end.to raise_error(/expected .* not to route to .*/)
+ end.to raise_error(/expected {:get=>"path"} not to route to {"these"=>"options"}/)
end
end

0 comments on commit 525ed7a

Please sign in to comment.