Sha256: 428c66a66f4c17534638b972ed6504181b04d50fe2cee94159098b7585eaff5a

Contents?: true

Size: 833 Bytes

Versions: 10

Compression:

Stored size: 833 Bytes

Contents

module RSpec::Rails::Matchers
  module RoutingMatchers
    extend RSpec::Matchers::DSL

    matcher :route_to do |route_options|
      match_unless_raises Test::Unit::AssertionFailedError do |path|
        assertion_path = { :method => path.keys.first, :path => path.values.first }
        assert_routing(assertion_path, route_options)
      end

      failure_message_for_should do
        rescued_exception.message
      end
    end

    matcher :be_routable do
      match_unless_raises ActionController::RoutingError do |path|
        @routing_options = routes.recognize_path(
          path.values.first, :method => path.keys.first
        )
      end

      failure_message_for_should_not do |path|
        "expected #{path.inspect} not to be routable, but it routes to #{@routing_options.inspect}"
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rspec-rails-2.0.0.rc lib/rspec/rails/matchers/routing_matchers.rb
rspec-rails-2.0.0.beta.22 lib/rspec/rails/matchers/routing_matchers.rb
rspec-rails-2.0.0.beta.20 lib/rspec/rails/matchers/routing_matchers.rb
rspec-rails-2.0.0.beta.19 lib/rspec/rails/matchers/routing_matchers.rb
rspec-rails-2.0.0.beta.18 lib/rspec/rails/matchers/routing_matchers.rb
rspec-rails-2.0.0.beta.17 lib/rspec/rails/matchers/routing_matchers.rb
rspec-rails-2.0.0.beta.16 lib/rspec/rails/matchers/routing_matchers.rb
rspec-rails-2.0.0.beta.15 lib/rspec/rails/matchers/routing_matchers.rb
rspec-rails-2.0.0.beta.14.2 lib/rspec/rails/matchers/routing_matchers.rb
rspec-rails-2.0.0.beta.14.1 lib/rspec/rails/matchers/routing_matchers.rb