Module: RSpec::Cells::ExampleGroup

Extended by:
ActiveSupport::Concern
Includes:
ActionController::UrlFor, Cell::Testing, Rails::RailsExampleGroup
Defined in:
lib/rspec/cells/example_group.rb

Defined Under Namespace

Modules: Controller

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



13
14
15
16
17
18
# File 'lib/rspec/cells/example_group.rb', line 13

def method_missing(method, *args, **kwargs, &block)
  # Send the route helpers to the application router.
  return super unless route_defined?(method)

  controller.send(method, *args, **kwargs, &block)
end

Instance Attribute Details

#routesObject (readonly)

Returns the value of attribute routes.



10
11
12
# File 'lib/rspec/cells/example_group.rb', line 10

def routes
  @routes
end

Instance Method Details

#route_defined?(method) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
31
32
33
34
35
36
# File 'lib/rspec/cells/example_group.rb', line 28

def route_defined?(method)
  return false unless @routes

  if @routes.named_routes.respond_to?(:route_defined?) # Rails > 4.2.
    @routes.named_routes.route_defined?(method)
  else
    @routes.named_routes.helpers.include?(method)
  end
end