Sha256: 8448b1d94a4acb94b5f9f321d90690ce71b46222c95ea92b3b5e94d0962bd287

Contents?: true

Size: 1.48 KB

Versions: 16

Compression:

Stored size: 1.48 KB

Contents

Feature: match unless raises

  In order, primarily, to reuse existing test/unit assertions
  As an RSpec user
  I want to define matchers that wrap a statement that raises an error on failure

  Background:
    Given a file named "example.rb" with:
      """
      require 'test/unit/assertions'

      Spec::Matchers.define :be_the_same_as do |expected|
        extend Test::Unit::Assertions
        match_unless_raises Test::Unit::AssertionFailedError do |actual|
          assert_equal expected, actual
        end
      end
      """
  
  Scenario: passing examples
    Given a file named "match_unless_raises_spec.rb" with:
      """
      require 'example.rb'

      describe 4 do
        it "is 4" do
          4.should be_the_same_as(4)
        end
      end

      describe 5 do
        it "is not 4" do
          5.should_not be_the_same_as(4)
        end
      end
      """
    When I run "spec match_unless_raises_spec.rb"
    Then the stdout should include "2 examples, 0 failures"

  Scenario: failing examples
    Given a file named "match_unless_raises_spec.rb" with:
      """
      require 'example.rb'

      describe 4 do
        it "is 4" do
          # intentionally fail
          4.should_not be_the_same_as(4)
        end
      end

      describe 5 do
        it "is not 4" do
          # intentionally fail
          5.should be_the_same_as(4)
        end
      end
      """
    When I run "spec match_unless_raises_spec.rb"
    Then the stdout should include "2 examples, 2 failures"

Version data entries

16 entries across 16 versions & 5 rubygems

Version Path
rspec-1.3.1 features/matchers/match_unless_raises.feature
rspec-1.3.1.rc features/matchers/match_unless_raises.feature
rspec-1.3.0 features/matchers/match_unless_raises.feature
media-path-0.1.2 vendor/rspec/features/matchers/match_unless_raises.feature
simple-templater-0.0.1.3 vendor/rspec/features/matchers/match_unless_raises.feature
pupu-0.0.2.pre vendor/rspec/features/matchers/match_unless_raises.feature
media-path-0.1.1.pre vendor/rspec/features/matchers/match_unless_raises.feature
simple-templater-0.0.1.2 vendor/rspec/features/matchers/match_unless_raises.feature
media-path-0.1.1 vendor/rspec/features/matchers/match_unless_raises.feature
simple-templater-0.0.1.1 vendor/rspec/features/matchers/match_unless_raises.feature
pupu-0.0.2 vendor/rspec/features/matchers/match_unless_raises.feature
rango-0.0.6 vendor/rspec/features/matchers/match_unless_raises.feature
rango-0.1.pre vendor/rspec/features/matchers/match_unless_raises.feature
pupu-0.0.1 vendor/rspec/features/matchers/match_unless_raises.feature
media-path-0.1 vendor/rspec/features/matchers/match_unless_raises.feature
simple-templater-0.0.1 vendor/rspec/features/matchers/match_unless_raises.feature