Skip to content

Commit

Permalink
Clarify one-liner syntax cannot be used with block matchers
Browse files Browse the repository at this point in the history
Users sometimes try to use the one-liner syntax with block matchers,
which can cause RSpec to behave in strange ways. This behaviour is not
supported in RSpec because the complexity of implementing it would
greatly outweigh the benefits.

This commit just clarifies in the documentation that the one-liner
syntax does not support block matchers.

Possible fix for rspec/rspec-expectations#805
  • Loading branch information
mrageh committed Jan 18, 2016
1 parent de91ba5 commit e24ced1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions features/subject/one_liner_syntax.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Feature: One-liner syntax

* This feature is only available when using rspec-expectations.
* Examples defined using this one-liner syntax cannot be directly selected from the command line using the [`--example` option](../command-line/example-option).
* The one-liner syntax only works with non-block expectations (e.g. `expect(obj).to eq`, etc) and it cannot be used with block expectations (e.g. `expect { object }`).

Scenario: Implicit subject
Given a file named "example_spec.rb" with:
Expand Down

0 comments on commit e24ced1

Please sign in to comment.