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

Preferred way to skip integration tests when running all? #116

Open
wkrsz opened this issue Jun 26, 2014 · 1 comment
Open

Preferred way to skip integration tests when running all? #116

wkrsz opened this issue Jun 26, 2014 · 1 comment

Comments

@wkrsz
Copy link

wkrsz commented Jun 26, 2014

I wanted Guard-Minitest to run integration test when I modify it, but skip them when running all tests.

My first take was:

guard :minitest, test_folders: %w[test/models test/controllers test/lib test/helpers test/mailers test/presenters] do

– however when I modified integration test Guard-Minitest wouldn't find it in provided paths and would instead run all tests.

Now I'm using a monkey-patch inside Guardfile:

# Guardfile

guard :minitest do
  watch(%r{^app/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
end

Guard::Minitest::Runner.module_eval do
  def run_all
    paths = inspector.clean_all.reject{|p| p.include?('/integration/') }
    run(paths, all: true)
  end
end

Do you know a more elengant solution?

@genericsteele
Copy link
Contributor

We could have an :exclude_from_all option that works similar to the :test_folders option. I'm open to a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants