Skip to content

Commit

Permalink
Add relish documentation for block_arg.
Browse files Browse the repository at this point in the history
Previously there was no way to discover this.
  • Loading branch information
xaviershay committed Oct 24, 2015
1 parent 199c2d7 commit 16a6616
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions features/custom_matchers/define_matcher.feature
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,28 @@ Feature: Define a custom matcher
And the stdout should contain "1 example, 0 failures"
And the stdout should contain "should be the sum of 1, 2, 3, and 4"

Scenario: With a block arg
Given a file named "matcher_with_block_arg_spec.rb" with:
"""ruby
require 'rspec/expectations'
RSpec::Matchers.define :be_lazily_equal_to do
match do |obj|
obj == block_arg.call
end
description { "be lazily equal to #{block_arg.call}" }
end
RSpec.describe 10 do
it { is_expected.to be_lazily_equal_to { 10 } }
end
"""
When I run `rspec ./matcher_with_block_arg_spec.rb --format documentation`
Then the exit status should be 0
And the stdout should contain "1 example, 0 failures"
And the stdout should contain "should be lazily equal to 10"

Scenario: With helper methods
Given a file named "matcher_with_internal_helper_spec.rb" with:
"""ruby
Expand Down

0 comments on commit 16a6616

Please sign in to comment.