class RSpec::Core::FilterManager

@see Configuration#filter_run_excluding
@see Configuration#filter_run_including
@see RSpec.configure
These declarations can also be overridden from the command line.
end
c.filter_run_excluding :foo => :bar
c.filter_run_including :foo => :bar
RSpec.configure do |c|
reasons we use the term ‘filter` in `RSpec.configure:
the command line (and in options files like `.rspec`), but for historical
You can also store default tags with `RSpec.configure`. We use `tag` on
## RSpec.configure
rspec –tag slow:true
this tag on the command line like this:
Of course, you probably want to run them sometimes, so you can override
## Overriding
Now when you run `rspec`, that group will be excluded.
–tag ~slow:true
And then store this in `.rspec`:
describe Something, :slow => true do
time. You can tag them like this:
say you’ve got some slow specs that you want to suppress most of the
options file. This is useful for storing defaults. For example, let’s
Tag declarations can be stored in ‘.rspec`, `~/.rspec`, or a custom
## Options files and command line overrides
rspec -t ~awesome
rspec -t ~awesome:true
rspec –tag ~awesome
rspec –tag ~awesome:true
any of:
Prefixing the tag names with `~` negates the tags, thus excluding this group with
rspec -t awesome
rspec -t awesome:true
rspec –tag awesome
rspec –tag awesome:true
with any of the following commands:
That group (or any other with `:awesome => true`) would be filtered in
end
end
# …
it “does something” do
describe Thing, :awesome => true do
and/or example declarations. For example, given this declaration:
`RSpec.configure`, with hash key/values submitted within example group
the command line or options files, or filters declared via
Manages the filtering of examples and groups by matching tags declared on

def add_location(file_path, line_numbers)

def add_location(file_path, line_numbers)
  # locations is a hash of expanded paths to arrays of line
  # numbers to match against. e.g.
  #   { "path/to/file.rb" => [37, 42] }
  locations = @inclusions.delete(:locations) || Hash.new {|h,k| h[k] = []}
  locations[File.expand_path(file_path)].push(*line_numbers)
  @inclusions.replace(:locations => locations)
  @exclusions.clear
end

def already_set_standalone_filter?

def already_set_standalone_filter?
  is_standalone_filter?(inclusions)
end

def empty?

def empty?
  inclusions.empty? && exclusions.empty_without_conditional_filters?
end

def exclude(*args)

def exclude(*args)
  merge(@exclusions, @inclusions, *args)
end

def exclude!(*args)

def exclude!(*args)
  replace(@exclusions, @inclusions, *args)
end

def exclude?(example)

def exclude?(example)
  @exclusions.empty? ? false : example.any_apply?(@exclusions)
end

def exclude_with_low_priority(*args)

def exclude_with_low_priority(*args)
  reverse_merge(@exclusions, @inclusions, *args)
end

def include(*args)

def include(*args)
  unless_standalone(*args) { merge(@inclusions, @exclusions, *args) }
end

def include!(*args)

def include!(*args)
  unless_standalone(*args) { replace(@inclusions, @exclusions, *args) }
end

def include?(example)

def include?(example)
  @inclusions.empty? ? true : example.any_apply?(@inclusions)
end

def include_with_low_priority(*args)

def include_with_low_priority(*args)
  unless_standalone(*args) { reverse_merge(@inclusions, @exclusions, *args) }
end

def initialize

def initialize
  @exclusions = DEFAULT_EXCLUSIONS.dup.extend(Describable)
  @inclusions = {}.extend(Describable)
  extend(BackwardCompatibility)
end

def is_standalone_filter?(filter)

def is_standalone_filter?(filter)
  STANDALONE_FILTERS.any? {|key| filter.has_key?(key)}
end

def merge(orig, opposite, *updates)

def merge(orig, opposite, *updates)
  orig.merge!(updates.last).each_key {|k| opposite.delete(k)}
end

def prune(examples)

def prune(examples)
  examples.select {|e| !exclude?(e) && include?(e)}
end

def replace(orig, opposite, *updates)

def replace(orig, opposite, *updates)
  updates.last.each_key {|k| opposite.delete(k)}
  orig.replace(updates.last)
end

def reverse_merge(orig, opposite, *updates)

def reverse_merge(orig, opposite, *updates)
  updated = updates.last.merge(orig)
  opposite.each_pair {|k,v| updated.delete(k) if updated[k] == v}
  orig.replace(updated)
end

def unless_standalone(*args)

def unless_standalone(*args)
  is_standalone_filter?(args.last) ? @inclusions.replace(args.last) : yield unless already_set_standalone_filter?
end