Sha256: fdf7378c899b0214710449639310c30a07aac88cd0d712149a2533097d460eff

Contents?: true

Size: 741 Bytes

Versions: 13

Compression:

Stored size: 741 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:
      """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

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_with_fluent_interface.feature
sshp-0.0.2 vendor/ruby/1.9.1/gems/rspec-expectations-2.13.0/features/custom_matchers/define_matcher_with_fluent_interface.feature
sshp-0.0.1 vendor/ruby/1.9.1/gems/rspec-expectations-2.13.0/features/custom_matchers/define_matcher_with_fluent_interface.feature
sidekiq-statsd-0.1.1 vendor/ruby/1.9.1/gems/rspec-expectations-2.13.0/features/custom_matchers/define_matcher_with_fluent_interface.feature
sidekiq-statsd-0.1.0 vendor/ruby/1.9.1/gems/rspec-expectations-2.13.0/features/custom_matchers/define_matcher_with_fluent_interface.feature
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/rspec-expectations-2.12.1/features/custom_matchers/define_matcher_with_fluent_interface.feature
vagrant-actionio-0.0.9 vendor/bundle/gems/rspec-expectations-2.13.0/features/custom_matchers/define_matcher_with_fluent_interface.feature
rspec-expectations-2.13.0 features/custom_matchers/define_matcher_with_fluent_interface.feature
remq-0.0.4 vendor/bundle/gems/rspec-expectations-2.12.1/features/custom_matchers/define_matcher_with_fluent_interface.feature
remq-0.0.3 vendor/bundle/gems/rspec-expectations-2.12.1/features/custom_matchers/define_matcher_with_fluent_interface.feature
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/rspec-expectations-2.12.1/features/custom_matchers/define_matcher_with_fluent_interface.feature
rspec-expectations-2.12.1 features/custom_matchers/define_matcher_with_fluent_interface.feature
rspec-expectations-2.12.0 features/custom_matchers/define_matcher_with_fluent_interface.feature