Sha256: 600ba09871d66f1e56a7e9281c394004d7f16cf41eb96db068bf686dc5beaf03

Contents?: true

Size: 761 Bytes

Versions: 4

Compression:

Stored size: 761 Bytes

Contents

require "action_dispatch/testing/assertions/routing"

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

    include RSpec::Rails::RailsExampleGroup

    include ActionDispatch::Assertions::RoutingAssertions
    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

    RSpec.configure &include_self_when_dir_matches('spec','routing')
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rspec-rails-2.3.1 lib/rspec/rails/example/routing_example_group.rb
rspec-rails-2.3.0 lib/rspec/rails/example/routing_example_group.rb
rspec-rails-2.2.1 lib/rspec/rails/example/routing_example_group.rb
rspec-rails-2.2.0 lib/rspec/rails/example/routing_example_group.rb