123456789_123456789_123456789_123456789_123456789_

Module: RSpec::Rails::RoutingExampleGroup::ClassMethods

Relationships & Source Files
Defined in: rspec-rails/lib/rspec/rails/example/routing_example_group.rb

Overview

Class-level DSL for route specs.

Instance Method Summary

  • #routes

    Specifies the routeset that will be used for the example group.

Instance Method Details

#routes

Specifies the routeset that will be used for the example group. This is most useful when testing ::RSpec::Rails engines.

Examples:

describe MyEngine::PostsController do
  routes { MyEngine::Engine.routes }

  it "routes posts#index" do
    expect(:get => "/posts").to
      route_to(:controller => "my_engine/posts", :action => "index")
  end
end
[ GitHub ]

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

def routes
  before do
    self.routes = yield
  end
end