Sha256: 30225279fa792c1ff3d52067681d02f816badab30c40ffa3518953ba6a977dbd

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

Feature: anonymous controller

  As a Rails developer using RSpec
  In order to specify behaviour of ApplicationController
  I want a simple DSL for generating anonymous subclasses

  Scenario: specify error handling in ApplicationController
    Given a file named "spec/controllers/application_controller_spec.rb" with:
      """
      require "spec_helper"

      class ApplicationController < ActionController::Base
        class AccessDenied < StandardError; end

        rescue_from AccessDenied, :with => :access_denied

      private

        def access_denied
          redirect_to "/401.html"
        end
      end

      describe ApplicationController do
        controller do
          def index
            raise ApplicationController::AccessDenied
          end
        end

        describe "handling AccessDenied exceptions" do
          it "redirects to the /401.html page" do
            get :index
            response.should redirect_to("/401.html")
          end
        end
      end
      """
    When I run "rspec spec"
    Then the output should contain "1 example, 0 failures"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-rails-2.0.0.beta.19 features/controller_specs/anonymous_controller.feature