Skip to content

Instantly share code, notes, and snippets.

@rummelonp
Created March 10, 2014 16:10
Show Gist options
  • Save rummelonp/9468056 to your computer and use it in GitHub Desktop.
Save rummelonp/9468056 to your computer and use it in GitHub Desktop.
RSpec の Routing のテストの出力綺麗にするやつ
module RSpec::Rails::Matchers
module RoutingMatchers
class RouteToMatcher
def description
method, path = @actual.first
expected = @expected.dup
to = "#{expected.delete(:controller)}##{expected.delete(:action)}"
str = "route #{method.upcase} \"#{path}\" to \"#{to}\""
if expected.any?
str << " with parameter #{expected.inspect}"
end
str
end
end
end
end
@rummelonp
Copy link
Author

これを spec/support/ 以下に放り込む

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment