Sha256: 0cab6e29363905eaed4ac82d627601d0855e3e21b0eb441d5c682a6182975be5

Contents?: true

Size: 1.6 KB

Versions: 5

Compression:

Stored size: 1.6 KB

Contents

Feature: Allow Cucumber to rescue exceptions

  Background: A controller that raises an exception
    Given I have created a new Rails app "rails-3-app" and installed cucumber-rails
    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
    Given 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 the feature run 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

5 entries across 5 versions & 1 rubygems

Version Path
cucumber-rails-1.6.0 features/allow_rescue.feature
cucumber-rails-1.5.0 features/allow_rescue.feature
cucumber-rails-1.4.5 features/allow_rescue.feature
cucumber-rails-1.4.4 features/allow_rescue.feature
cucumber-rails-1.4.3 features/allow_rescue.feature