This repository was archived by the owner on Nov 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +19
-11
lines changed Expand file tree Collapse file tree 2 files changed +19
-11
lines changed Original file line number Diff line number Diff line change 1
1
Feature : inclusion filters
2
2
3
- You can restrict which examples are run by declaring an inclusion filter. The
3
+ You can constrain which examples are run by declaring an inclusion filter. The
4
4
most common use case is to focus on a subset of examples as you're focused on
5
5
a particular problem.
6
6
7
- If you set the `treat_symbols_as_metadata_keys_with_true_values` config option
8
- to `true`, you can specify metadata using only symbols .
7
+ You can specify metadata using only symbols if you set the
8
+ `treat_symbols_as_metadata_keys_with_true_values` config option to `true` .
9
9
10
10
Background :
11
11
Given a file named "spec/spec_helper.rb" with:
12
12
"""
13
13
RSpec.configure do |c|
14
- # filter_run is short-form alias for filter_run_including
15
- c.filter_run :focus => true
14
+ c.filter_run_including :focus => true
16
15
end
17
16
"""
18
17
Original file line number Diff line number Diff line change 1
1
Feature : filters
2
2
3
- `before`/`after`/`around` hooks defined in the RSpec configuration block can
4
- be filtered using metadata. Arbitrary metadata can be applied to an example
5
- or example group, and used to make a hook only apply to examples with the
6
- given metadata.
3
+ `before`, `after`, and `around` hooks defined in the block passed to
4
+ `RSpec.configure` can be constrained to specific examples and/or groups using
5
+ metadata as a filter.
7
6
8
- If you set the `treat_symbols_as_metadata_keys_with_true_values` config option
9
- to `true`, you can specify metadata using only symbols.
7
+ RSpec.configure do |c|
8
+ c.before(:each, :type => :model) do
9
+ # ...
10
+ end
11
+ end
12
+
13
+ describe "something" , :type => :model do
14
+ # ...
15
+ end
16
+
17
+ You can specify metadata using only symbols if you set the
18
+ `treat_symbols_as_metadata_keys_with_true_values` config option to `true`.
10
19
11
20
Scenario : filter `before(:each)` hooks using arbitrary metadata
12
21
Given a file named "filter_before_each_hooks_spec.rb" with:
You can’t perform that action at this time.
0 commit comments