Sha256: b53a4b25efcc537342f651757cc22233c89173fc49c9d1183158a40f24be57ba

Contents?: true

Size: 649 Bytes

Versions: 1

Compression:

Stored size: 649 Bytes

Contents

require "action_dispatch/testing/assertions/routing"

module RSpec::Rails
  module RoutingExampleGroup
    extend ActiveSupport::Concern

    include ActionDispatch::Assertions::RoutingAssertions
    include RSpec::Rails::RailsExampleGroup
    include RSpec::Rails::Matchers::RoutingMatchers

    module InstanceMethods
      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

    included do
      metadata[:type] = :routing

      before do
        @routes = ::Rails.application.routes
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-rails-2.4.0 lib/rspec/rails/example/routing_example_group.rb