Sha256: ccdcfd866a377cd022efac974dc933eb1624a12b84f703d3e4ea81cec932e5ea

Contents?: true

Size: 1.03 KB

Versions: 35

Compression:

Stored size: 1.03 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

35 entries across 35 versions & 8 rubygems

Version Path
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/rspec-expectations-2.14.5/features/custom_matchers/define_matcher_outside_rspec.feature
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/gems/rspec-expectations-2.14.5/features/custom_matchers/define_matcher_outside_rspec.feature
vagrant-unbundled-1.9.1.1 vendor/bundle/ruby/2.4.0/gems/rspec-expectations-2.14.5/features/custom_matchers/define_matcher_outside_rspec.feature
vagrant-unbundled-1.8.5.2 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/features/custom_matchers/define_matcher_outside_rspec.feature
vagrant-unbundled-1.8.5.1 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/features/custom_matchers/define_matcher_outside_rspec.feature
vagrant-unbundled-1.8.4.2 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/features/custom_matchers/define_matcher_outside_rspec.feature
vagrant-unbundled-1.8.4.1 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/features/custom_matchers/define_matcher_outside_rspec.feature
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/features/custom_matchers/define_matcher_outside_rspec.feature
vagrant-cloudstack-1.1.0 vendor/bundle/gems/rspec-expectations-2.14.5/features/custom_matchers/define_matcher_outside_rspec.feature
rspec-expectations-2.99.2 features/custom_matchers/define_matcher_outside_rspec.feature
dxruby_rp5-0.0.4 spec/vendor/rspec-expectations-2.14.4/features/custom_matchers/define_matcher_outside_rspec.feature
rspec-expectations-2.99.1 features/custom_matchers/define_matcher_outside_rspec.feature
rspec-expectations-2.99.0 features/custom_matchers/define_matcher_outside_rspec.feature
rspec-expectations-2.99.0.rc1 features/custom_matchers/define_matcher_outside_rspec.feature
rspec-expectations-2.99.0.beta2 features/custom_matchers/define_matcher_outside_rspec.feature
rspec-expectations-2.14.5 features/custom_matchers/define_matcher_outside_rspec.feature
mango-0.8.0 vendor/bundler/ruby/2.1.0/gems/rspec-expectations-2.14.4/features/custom_matchers/define_matcher_outside_rspec.feature
mango-0.7.1 vendor/bundler/ruby/2.0.0/gems/rspec-expectations-2.14.4/features/custom_matchers/define_matcher_outside_rspec.feature
dxruby_rp5-0.0.3 spec/vendor/rspec-expectations-2.14.4/features/custom_matchers/define_matcher_outside_rspec.feature
tuktuk-rails-0.0.10 vendor/bundle/ruby/2.0.0/gems/rspec-expectations-2.14.4/features/custom_matchers/define_matcher_outside_rspec.feature