123456789_123456789_123456789_123456789_123456789_

Module: RSpec::Rails::RoutingExampleGroup

Relationships & Source Files
Namespace Children
Modules:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
self, RSpec::Rails::AssertionDelegator.new( ActionDispatch::Assertions::RoutingAssertions ), Matchers::RoutingMatchers::RouteHelpers, Matchers::RoutingMatchers, RailsExampleGroup, ActiveSupport::ExecutionContext::TestHelper, ActiveSupport::CurrentAttributes::TestHelper, TaggedLoggingAdapter, FixtureSupport::Fixtures, FixtureSupport, ActiveRecord::TestFixtures, MinitestAssertionAdapter, MinitestLifecycleAdapter, SetupAndTeardownAdapter
Defined in: rspec-rails/lib/rspec/rails/example/routing_example_group.rb

Overview

Container module for routing spec functionality.

Class Method Summary

MinitestAssertionAdapter::ClassMethods - Extended

assertion_method_names

Returns the names of assertion methods that we want to expose to examples without exposing non-assertion methods in Test::Unit or Minitest.

define_assertion_delegators

SetupAndTeardownAdapter::ClassMethods - Extended

setup

Wraps setup calls from within Rails’ testing framework in before hooks.

teardown

Wraps teardown calls from within Rails’ testing framework in after hooks.

Instance Attribute Summary

FixtureSupport - Included

#run_in_transaction?

Monkey patched to avoid collisions with ‘let(:name)’ since ::RSpec::Rails 6.1.

Instance Method Summary

Matchers::RoutingMatchers::RouteHelpers - Included

#delete

Shorthand method for matching this type of route.

#get

Shorthand method for matching this type of route.

#head

Shorthand method for matching this type of route.

#options

Shorthand method for matching this type of route.

#patch

Shorthand method for matching this type of route.

#post

Shorthand method for matching this type of route.

#put

Shorthand method for matching this type of route.

Matchers::RoutingMatchers - Included

#be_routable

Passes if the route expression is recognized by the ::RSpec::Rails router based on the declarations in config/routes.rb.

#route_to

Delegates to assert_recognizes.

TaggedLoggingAdapter - Included

#tagged_logger

Vendored from activesupport/lib/active_support/testing/tagged_logging.rb This implements the tagged_logger method where it is expected, but doesn’t call name or set it up like ::RSpec::Rails does.

MinitestAssertionAdapter - Included

MinitestLifecycleAdapter - Included

SetupAndTeardownAdapter - Included

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) (private)

[ GitHub ]

  
# File 'rspec-rails/lib/rspec/rails/example/routing_example_group.rb', line 56

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

DSL Calls

included

[ GitHub ]


38
39
40
41
42
# File 'rspec-rails/lib/rspec/rails/example/routing_example_group.rb', line 38

included do
  before do
    self.routes = ::Rails.application.routes
  end
end

Instance Attribute Details

#routes (rw)

This method is for internal use only.
[ GitHub ]

  
# File 'rspec-rails/lib/rspec/rails/example/routing_example_group.rb', line 46

attr_reader :routes

#routes=(routes) (rw)

This method is for internal use only.
[ GitHub ]

  
# File 'rspec-rails/lib/rspec/rails/example/routing_example_group.rb', line 49

def routes=(routes)
  @routes = routes
  assertion_instance.instance_variable_set(:@routes, routes)
end