Sha256: 9c640fa69747bec892a86e24b4be0785b7ff7c23fe07a33d308e6871a779b18b

Contents?: true

Size: 1.06 KB

Versions: 13

Compression:

Stored size: 1.06 KB

Contents

Feature: define matcher outside rspec

  In order to express my domain clearly in my code examples
  As a non-rspec user
  I want a shortcut to define custom matchers

  Scenario: define a matcher with default messages
    Given a file named "test_multiples.rb" with:
      """ruby
      require "rspec/expectations"
      require "test/unit"
      
      RSpec::Matchers.define :be_a_multiple_of do |expected|
        match do |actual|
          actual % expected == 0
        end
      end
      
      class Test::Unit::TestCase
        include RSpec::Matchers
      end
      
      class TestMultiples < Test::Unit::TestCase
      
        def test_9_should_be_a_multiple_of_3
          9.should be_a_multiple_of(3)
        end

        def test_9_should_be_a_multiple_of_4
          9.should be_a_multiple_of(4)
        end
        
      end
      """
    When I run `ruby test_multiples.rb`
    Then the exit status should not be 0 
    And the output should contain "expected 9 to be a multiple of 4"
    And the output should contain "2 tests, 0 assertions, 0 failures, 1 errors"

Version data entries

13 entries across 13 versions & 7 rubygems

Version Path
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/rspec-expectations-2.13.0/features/custom_matchers/define_matcher_outside_rspec.feature
sshp-0.0.2 vendor/ruby/1.9.1/gems/rspec-expectations-2.13.0/features/custom_matchers/define_matcher_outside_rspec.feature
sshp-0.0.1 vendor/ruby/1.9.1/gems/rspec-expectations-2.13.0/features/custom_matchers/define_matcher_outside_rspec.feature
sidekiq-statsd-0.1.1 vendor/ruby/1.9.1/gems/rspec-expectations-2.13.0/features/custom_matchers/define_matcher_outside_rspec.feature
sidekiq-statsd-0.1.0 vendor/ruby/1.9.1/gems/rspec-expectations-2.13.0/features/custom_matchers/define_matcher_outside_rspec.feature
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/rspec-expectations-2.12.1/features/custom_matchers/define_matcher_outside_rspec.feature
vagrant-actionio-0.0.9 vendor/bundle/gems/rspec-expectations-2.13.0/features/custom_matchers/define_matcher_outside_rspec.feature
rspec-expectations-2.13.0 features/custom_matchers/define_matcher_outside_rspec.feature
remq-0.0.4 vendor/bundle/gems/rspec-expectations-2.12.1/features/custom_matchers/define_matcher_outside_rspec.feature
remq-0.0.3 vendor/bundle/gems/rspec-expectations-2.12.1/features/custom_matchers/define_matcher_outside_rspec.feature
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/rspec-expectations-2.12.1/features/custom_matchers/define_matcher_outside_rspec.feature
rspec-expectations-2.12.1 features/custom_matchers/define_matcher_outside_rspec.feature
rspec-expectations-2.12.0 features/custom_matchers/define_matcher_outside_rspec.feature