Sha256: 746274ab5a79d016f06c52a1c3b0146d572bd69f069a60124e9b5415e362b40a

Contents?: true

Size: 759 Bytes

Versions: 4

Compression:

Stored size: 759 Bytes

Contents

Feature: define matcher

  In order to express my domain clearly in my code examples
  As an RSpec user
  I want to define matchers with fluent interfaces
  
  Scenario: one additional method
    Given a file named "between_spec.rb" with:
      """
      Rspec::Matchers.define :be_bigger_than do |first|
        def but_smaller_than(second)
          @second = second
          self
        end
        
        match do |actual|
          (actual > first) && (actual < @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 I should see "1 example, 0 failures"
    And  I should see "should be bigger than 4"

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rspec-expectations-2.0.0.beta.8 features/matchers/define_matcher_with_fluent_interface.feature
rspec-expectations-2.0.0.beta.7 features/matchers/define_matcher_with_fluent_interface.feature
rspec-expectations-2.0.0.beta.6 features/matchers/define_matcher_with_fluent_interface.feature
rspec-expectations-2.0.0.beta.5 features/matchers/define_matcher_with_fluent_interface.feature