Skip to content

Commit

Permalink
Update manual
Browse files Browse the repository at this point in the history
  • Loading branch information
pirj committed Jan 10, 2019
1 parent 9c0fd1b commit cb8a1d0
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions manual/cops_rspec.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ Disabled | Yes

Checks if example groups contain more than one aggregateable example.

This cop is primarily for reducing the cost of repeated expensive
context initialization.

Consider turning [`aggregate_failures`](https://relishapp.com/rspec/rspec-core/docs/expectation-framework-integration/aggregating-failures)
on in RSpec configuration to see all the failures at once, rather than
it aborting on the first failure.

config.define_derived_metadata do |metadata|
unless metadata.key?(:aggregate_failures)
metadata[:aggregate_failures] = true
end
end

### Examples

```ruby
Expand Down Expand Up @@ -67,6 +80,28 @@ it { is_expected.to do_something }
# 3. Aggregation of block syntax with non-block syntax should be in a
# specific order.
```
#### configuration

```ruby
# .rubocop.yml
# RSpec/AggregateExamples:
# MatchersWithSideEffects:
# - allow_value
# - allow_values
# - validate_presence_of

# not detected as aggregateable
describe do
it { is_expected.to validate_presence_of(:comment) }
it { is_expected.to be_valid }
end
```

### Configurable attributes

Name | Default value | Configurable values
--- | --- | ---
MatchersWithSideEffects | `allow_value`, `allow_values`, `validate_presence_of`, `validate_absence_of`, `validate_length_of`, `validate_inclusion_of`, `validates_exclusion_of` | Array

### References

Expand Down

0 comments on commit cb8a1d0

Please sign in to comment.