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

rails-minitest support #290

Closed
nTraum opened this issue Mar 19, 2014 · 4 comments
Closed

rails-minitest support #290

nTraum opened this issue Mar 19, 2014 · 4 comments

Comments

@nTraum
Copy link

nTraum commented Mar 19, 2014

Hi,

As it seems, rails-minitest and simplecov don't work nicely together yet, regardless of wether you use spec or unit test style (#235). When running the test suite via rake, the reported coverage seems to be wrong.

I'd like to help identify the problem and fix this.


Here's what I experienced and how my setup looks like (nTraum/tf2movies, I'm using spec style).

Test directory structure

Vanilla minitest-rails:

├── app
├── test
│   ├── controllers
│   │   └─── foos_controller_test.rb
│   ├── integration
│   ├── models
│   │   └─── foo_test.rb
│   └── test_helper.rb

With test_helper.rb requiring simplecov and starting SimpleCov with the rails profile at the very top.

Running the test suite

minitest-rails offers the following commands:

$ rake -D minitest
rake minitest
    Run default tests

rake minitest:all
    Run all tests

rake minitest:all:quick
    Run all tests, ungrouped for quicker execution

rake minitest:controllers
    Runs tests under test/controllers

rake minitest:integration
    Runs tests under test/integration

rake minitest:models
    Runs tests under test/models
Observations

rake minitest:all:quick, which runs all tests within one rake task works as expected, reported coverage is correct.

rake minitest:all, which seems to invoke separate rake tasks for each dir under test (correct me if I'm wrong) overrides previous coverage reports.

rake minitest:models, which only runs tests under test/models reports test coverage correctly for models. SimpleCov prints the following line though:

Coverage report generated for Integration Tests, Unit Tests to /home/ntraum/coding/tf2movies/coverage. 202 / 214 LOC (94.39%) covered.

Integration tests were not executed though.

rake minitest:controllers, s.a.

That's all I got.

@ancorgs
Copy link

ancorgs commented May 22, 2014

Very similar problem with minitest-spec-rails You can reproduce the problem easily using https://github.com/ancorgs/mutant_tracker

@bf4
Copy link
Collaborator

bf4 commented Jul 13, 2014

What's in your Rakefile? See my comment #314 (comment)

@bf4
Copy link
Collaborator

bf4 commented Jul 17, 2014

Both repos use the default Rakefile. I'd recommend requiring SimpleCov at the very top, and either starting SimpleCov there, or using a .simplecov file

@bf4 bf4 closed this as completed Jul 17, 2014
@nTraum
Copy link
Author

nTraum commented Jul 17, 2014

Thank you. 👯

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

3 participants