Sha256: 8e1f71ee9d9e634c83f6c54e7c7438faa870fd09f81f840e691aae408563eaa8

Contents?: true

Size: 737 Bytes

Versions: 4

Compression:

Stored size: 737 Bytes

Contents

Feature: define matcher with fluent interface

  Use the chain() method to define matchers with a fluent interface.
  
  Scenario: chained method with argumetn
    Given a file named "between_spec.rb" with:
      """
      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

4 entries across 4 versions & 2 rubygems

Version Path
messagebus_ruby_api-0.4.7 spec/ruby/1.9.1/gems/rspec-expectations-2.5.0/features/custom_matchers/define_matcher_with_fluent_interface.feature
messagebus_ruby_api-0.4.4 spec/ruby/1.9.1/gems/rspec-expectations-2.5.0/features/custom_matchers/define_matcher_with_fluent_interface.feature
rspec-expectations-2.5.0 features/custom_matchers/define_matcher_with_fluent_interface.feature
rspec-expectations-2.4.0 features/custom_matchers/define_matcher_with_fluent_interface.feature