Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove run_all_when_everything_filtered configuration option #2845

Merged
merged 1 commit into from
Jan 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Breaking Changes:
* Extract `should` syntax (including the non-monkey-patching one liner). (Phil Pirozhkov, #2803)
* Remove globally-exposed DSL (example and shared group methods
in the root scope and on Module). (Phil Pirozhkov, #2803)
* Remove `run_all_when_everything_filtered` configuration option. (Phil Pirozhkov, #2845)

Enhancements:

Expand Down
1 change: 0 additions & 1 deletion features/.nav
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
- exclusion_filters.feature
- if_and_unless.feature
- filter_run_when_matching.feature
- run_all_when_everything_filtered.feature
- configuration:
- read_options_from_file.feature
- color.feature
Expand Down
82 changes: 0 additions & 82 deletions features/configuration/run_all_when_everything_filtered.feature

This file was deleted.

6 changes: 0 additions & 6 deletions lib/rspec/core/bisect/fork_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,6 @@ def run_specs(run_descriptor)
c.load_spec_files
end

# `announce_filters` has the side effect of implementing the logic
# that honors `config.run_all_when_everything_filtered` so we need
# to call it here. When we remove `run_all_when_everything_filtered`
# (slated for RSpec 4), we can remove this call to `announce_filters`.
@runner.world.announce_filters

@runner.run_specs(@runner.world.ordered_example_groups)
latest_run_results = formatter.results

Expand Down
7 changes: 0 additions & 7 deletions lib/rspec/core/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -302,13 +302,6 @@ def exclude_pattern=(value)
attr_writer :profile_examples
define_predicate :profile_examples

# @macro add_setting
# Run all examples if none match the configured filters
# (default: `false`).
# @deprecated Use {#filter_run_when_matching} instead for the specific
# filters that you want to be ignored if none match.
add_setting :run_all_when_everything_filtered

# @macro add_setting
# Color to use to indicate success. Defaults to `:green` but can be set
# to one of the following: `[:black, :white, :red, :green, :yellow,
Expand Down
6 changes: 0 additions & 6 deletions lib/rspec/core/world.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,6 @@ def announce_filters
end
end

if @configuration.run_all_when_everything_filtered? && example_count.zero? && !@configuration.only_failures?
report_filter_message("#{everything_filtered_message}; ignoring #{inclusion_filter.description}")
filtered_examples.clear
inclusion_filter.clear
end

return unless example_count.zero?

example_groups.clear
Expand Down
21 changes: 0 additions & 21 deletions spec/integration/bisect_runners_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,27 +50,6 @@ def with_runner(&block)
end
end

it 'honors `run_all_when_everything_filtered`' do
write_file 'spec/a_spec.rb', "
RSpec.configure do |c|
c.filter_run :focus
c.run_all_when_everything_filtered = true
end

RSpec.describe 'A group' do
it('passes') { expect(1).to eq 1 }
it('fails') { expect(1).to eq 2 }
end
"

with_runner do |runner|
expect(runner.original_results).to have_attributes(
:all_example_ids => %w[ ./spec/a_spec.rb[1:1] ./spec/a_spec.rb[1:2] ],
:failed_example_ids => %w[ ./spec/a_spec.rb[1:2] ]
)
end
end

it 'raises BisectFailedError with all run output when it encounters an error loading spec files' do
write_file 'spec/a_spec.rb', "
puts 'stdout in a_spec'
Expand Down
11 changes: 0 additions & 11 deletions spec/rspec/core/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1293,17 +1293,6 @@ def metadata_hash(*args)

end

describe "#run_all_when_everything_filtered?" do
it "defaults to false" do
expect(config.run_all_when_everything_filtered?).to be(false)
end

it "can be queried by predicate method" do
config.run_all_when_everything_filtered = true
expect(config.run_all_when_everything_filtered?).to be(true)
end
end

describe "#color_mode" do
context ":automatic" do
before do
Expand Down
23 changes: 0 additions & 23 deletions spec/rspec/core/world_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,19 +217,6 @@ def preceding_declaration_line(line_num)
context "when --only-failures is passed" do
before { configuration.force(:only_failures => true) }

context "and all examples are filtered out" do
before do
configuration.filter_run_including :foo => 'bar'
end

it 'will ignore run_all_when_everything_filtered' do
configuration.run_all_when_everything_filtered = true
expect(world.filtered_examples).to_not receive(:clear)
expect(world.inclusion_filter).to_not receive(:clear)
world.announce_filters
end
end

context "and `example_status_persistence_file_path` is not configured" do
it 'aborts with a message explaining the config option must be set first' do
configuration.example_status_persistence_file_path = nil
Expand Down Expand Up @@ -287,16 +274,6 @@ def preceding_declaration_line(line_num)
end
end

context "with an inclusion filter and run_all_when_everything_filtered" do
it "announces" do
allow(configuration).to receive(:run_all_when_everything_filtered?) { true }
configuration.filter_run_including :foo => 'bar'
expect(reporter).to receive(:message).
with(/All examples were filtered out/)
world.announce_filters
end
end

context "with an exclusion filter" do
it "announces" do
configuration.filter_run_excluding :foo => 'bar'
Expand Down