Sha256: 1dd3fb084947c4134c2e4f131b17af54d3dfda4b5206338f0f970b7bca17c775

Contents?: true

Size: 992 Bytes

Versions: 7

Compression:

Stored size: 992 Bytes

Contents

Feature: engine routes

  Routing specs can specify the routeset that will be used for the example
  group. This is most useful when testing Rails engines.

  @unsupported-on-rails-3-0
  Scenario: specify engine route
    Given a file named "spec/routing/engine_routes_spec.rb" with:
    """ruby
    require "spec_helper"

    # A very simple Rails engine
    module MyEngine
      class Engine < ::Rails::Engine
        isolate_namespace MyEngine
      end

      Engine.routes.draw do
        resources :widgets, :only => [:index]
      end

      class WidgetsController < ::ActionController::Base
        def index
        end
      end
    end

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

      it "routes to the list of all widgets" do
        expect(:get => widgets_path).
          to route_to(:controller => "my_engine/widgets", :action => "index")
      end
    end
    """
    When I run `rspec spec`
    Then the examples should all pass

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rspec-rails-3.0.0.beta2 features/routing_specs/engine_routes.feature
rspec-rails-2.99.0.beta2 features/routing_specs/engine_routes.feature
rspec-rails-2.14.1 features/routing_specs/engine_routes.feature
rspec-rails-3.0.0.beta1 features/routing_specs/engine_routes.feature
rspec-rails-2.99.0.beta1 features/routing_specs/engine_routes.feature
rspec-rails-2.14.0 features/routing_specs/engine_routes.feature
rspec-rails-2.13.1 features/routing_specs/engine_routes.feature