Sha256: e6889df0f42a85ac1c761bf73f6210ecb7af15868ed599da4623bb763585b3bf

Contents?: true

Size: 1.69 KB

Versions: 9

Compression:

Stored size: 1.69 KB

Contents

Feature: Allow Cucumber to rescue exceptions

  Background: A controller that raises an exception in a Rails app without web_steps.rb
    Given I have created a new Rails 3 app "rails-3-app" with cucumber-rails support
    And I remove the file "features/step_definitions/web_steps.rb"
    And I write to "app/controllers/posts_controller.rb" with:
      """
      class PostsController < ApplicationController
        def index
          raise "There is an error in index"
        end
      end
      """
    And I write to "config/routes.rb" with:
      """
      Rails3App::Application.routes.draw do
        resources :posts
      end
      """

  Scenario: Allow rescue
    And I write to "features/posts.feature" with:
      """
      Feature: posts
        @allow-rescue
        Scenario: See posts
          When I look at the posts
      """
    And I write to "features/step_definitions/posts_steps.rb" with:
      """
      When /^I look at the posts$/ do
        visit '/posts'
      end
      """
    And I run `bundle exec rake db:migrate`
    And I run `bundle exec cucumber`
    Then it should pass with:
      """
      1 scenario (1 passed)
      1 step (1 passed)
      """

  Scenario: Don't allow rescue
    Given I write to "features/posts.feature" with:
      """
      Feature: posts
        Scenario: See them
          When I look at the posts
      """
    And I write to "features/step_definitions/posts_steps.rb" with:
      """
      When /^I look at the posts$/ do
        visit '/posts'
      end
      """
    And I run `bundle exec rake db:migrate`
    And I run `bundle exec cucumber`
    Then it should fail with:
       """
       1 scenario (1 failed)
       1 step (1 failed)
       """

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
casecumber-rails-1.0.2.1 features/allow_rescue.feature
cucumber-rails-1.0.6 features/allow_rescue.feature
cucumber-rails-1.0.5 features/allow_rescue.feature
cucumber-rails-1.0.4 features/allow_rescue.feature
cucumber-rails-1.0.3 features/allow_rescue.feature
cucumber-rails-1.0.2 features/allow_rescue.feature
cucumber-rails-1.0.1 features/allow_rescue.feature
cucumber-rails-1.0.0 features/allow_rescue.feature
cucumber-rails-0.5.2 features/allow_rescue.feature