Sha256: f58bf491fbfd4c1c4240a7e2eec12f354e8ffb82c307f127ba66652c31960166

Contents?: true

Size: 739 Bytes

Versions: 2

Compression:

Stored size: 739 Bytes

Contents

Feature: define matcher with fluent interface

  Use the chain() method to define matchers with a fluent interface.

  Scenario: chained method with argument
    Given a file named "between_spec.rb" with:
      """ruby
      RSpec::Matchers.define :be_bigger_than do |first|
        match do |actual|
          (actual > first) && (actual < @second)
        end

        chain :but_smaller_than do |second|
          @second = second
        end
      end

      describe 5 do
        it { should be_bigger_than(4).but_smaller_than(6) }
      end
      """
    When I run `rspec between_spec.rb --format documentation`
    Then the output should contain "1 example, 0 failures"
    And  the output should contain "should be bigger than 4"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspec-expectations-3.0.0.beta2 features/custom_matchers/define_matcher_with_fluent_interface.feature
rspec-expectations-3.0.0.beta1 features/custom_matchers/define_matcher_with_fluent_interface.feature