Using config.filter_run_excluding :tag => true with --tag tag should run specs tagged with 'tag' #369

Closed
joefiorini opened this Issue May 12, 2011 · 5 comments

Comments

Projects
None yet
3 participants

I created this scenario in features/filtering/exclusion_filters.feature. It currently fails, but the ability to override exclusion filters at the command line makes sense to me. Is there a reason it shouldn't?

Scenario: Command line tag inclusion overrides config.filter_run_excluding

Given a file named "spec/sample_spec.rb" with:

    RSpec.configure do |c|
      c.filter_run_excluding :javascript => true
    end

    describe "something" do
      it "does one thing" do
      end

      it "does another thing", :javascript => true do
      end
    end

When I run `rspec ./spec/sample_spec.rb --format doc --tag javascript`
Then the output should contain "does another thing"
And the output should not contain "does one thing"
Owner

dchelimsky commented May 27, 2011

Hey Joe - I like the idea, but I'd want to roll it out as part of a bigger effort to better align the command line and RSpec.configuration options. I'm going to leave this open to start the conversation.

sl4m commented Sep 7, 2011

I'm bringing this back from the dead. I would love to see this feature working as we're currently having to comment out

c.filter_run_excluding :integration => true

in order to run the excluded tests. I think it makes sense for the command-line tag option to override what is defined in RSpec.configure

Owner

dchelimsky commented Oct 25, 2011

Did some preliminary refactoring in advance of this - should have it worked out for the next minor release (2.8).

dchelimsky was assigned Oct 25, 2011

@dchelimsky dchelimsky added a commit that referenced this issue Oct 29, 2011

@dchelimsky dchelimsky Opposite filters (tags) with higher precedence cancel out those with …
…lower precedence

Beginning to address #369 and #327.

This commit deals with command line, ENV and file options, but does not
address options defined with RSpec.configure. Once that's addressed we
can close #369 and #327.

This does, implicitly, let --tag options set in rake tasks overwrite
those in option files.
7ec4903

dchelimsky reopened this Oct 29, 2011

dchelimsky closed this in 602c23b Nov 4, 2011

dchelimsky reopened this Nov 4, 2011

Owner

dchelimsky commented Nov 4, 2011

That commit is on a branch, so I'm leaving this open until I merge it. I want to make this work correctly with all options, so there's a bit more work to do before merging it, but I'm hoping to get it done soon. Once this issue is closed we'll release 2.8.

dchelimsky closed this in 2de55b8 Nov 4, 2011

sl4m commented Nov 5, 2011

thanks David!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment