Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Report exclusion filters (closes #347)

  • Loading branch information...
commit 36237841db72eeb7797f199ad0fa057e36e26b40 1 parent eae6b43
@patmaddox patmaddox authored
View
4 features/command_line/tag.feature
@@ -82,3 +82,7 @@ Feature: --tag option
"""
Then the examples should all pass
+ Scenario: filter examples with a simple tag, exclude examples with another tag
+ When I run `rspec . --tag focus --tag ~skip`
+ Then the output should contain "Run filtered using {:focus=>true}, excluding {:skip=>true}"
+ And the examples should all pass
View
3  lib/rspec/core/command_line.rb
@@ -16,8 +16,7 @@ def run(err, out)
@configuration.output_stream ||= out
@options.configure(@configuration)
@configuration.load_spec_files
- @world.announce_inclusion_filter
- @world.announce_exclusion_filter
+ @world.announce_filters
@configuration.reporter.report(@world.example_count) do |reporter|
begin
View
18 lib/rspec/core/world.rb
@@ -59,25 +59,35 @@ def preceding_declaration_line(filter_line)
end
end
- def announce_inclusion_filter
+ def announce_filters
+ filter_announcements = []
+ announce_inclusion_filter filter_announcements
+ announce_exclusion_filter filter_announcements
+
+ unless filter_announcements.empty?
+ @configuration.reporter.message("Run filtered #{filter_announcements.join(', ')}")
+ end
+ end
+
+ def announce_inclusion_filter(announcements)
if inclusion_filter
if @configuration.run_all_when_everything_filtered? && RSpec.world.example_count.zero?
@configuration.reporter.message "No examples were matched by #{inclusion_filter.inspect}, running all"
@configuration.clear_inclusion_filter
filtered_examples.clear
else
- @configuration.reporter.message "Run filtered using #{inclusion_filter.inspect}"
+ announcements << "using #{inclusion_filter.inspect}"
end
end
end
- def announce_exclusion_filter
+ def announce_exclusion_filter(announcements)
if exclusion_filter && RSpec.world.example_count.zero?
@configuration.reporter.message(
"No examples were matched. Perhaps #{exclusion_filter.inspect} is excluding everything?")
example_groups.clear
else
- @configuration.reporter.message "Run filtered excluding #{exclusion_filter.inspect}"
+ announcements << "excluding #{exclusion_filter.inspect}"
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.