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


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

def method_missing(method, *args, &block)
  # Send the route helpers to the application router.
  if route_defined?(method)
    controller.send(method, *args, &block)
  else
    super
  end
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)

21
22
23
24
25
26
27
28
29
# File 'lib/rspec/cells/example_group.rb', line 21

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