Sha256: 7e9a619f1b1328299dce31b59de71e58079cf89229babb45cf191ba6d4c01c17

Contents?: true

Size: 775 Bytes

Versions: 4

Compression:

Stored size: 775 Bytes

Contents

require "action_dispatch/testing/assertions/routing"

module RSpec::Rails
  module RoutingExampleGroup
    extend ActiveSupport::Concern
    include RSpec::Rails::RailsExampleGroup
    include RSpec::Rails::Matchers::RoutingMatchers
    include RSpec::Rails::Matchers::RoutingMatchers::RouteHelpers
    include RSpec::Rails::AssertionDelegator.new(ActionDispatch::Assertions::RoutingAssertions)

    included do
      metadata[:type] = :routing

      before do
        @routes = ::Rails.application.routes
        assertion_instance.instance_variable_set(:@routes, @routes)
      end
    end

    attr_reader :routes

    private

    def method_missing(m, *args, &block)
      routes.url_helpers.respond_to?(m) ? routes.url_helpers.send(m, *args) : super
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/rspec-rails-2.13.0/lib/rspec/rails/example/routing_example_group.rb
rspec-rails-2.13.0 lib/rspec/rails/example/routing_example_group.rb
rspec-rails-2.12.2 lib/rspec/rails/example/routing_example_group.rb
rspec-rails-2.12.1 lib/rspec/rails/example/routing_example_group.rb