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

Guard-minitest does not seem to work with spring in a Rails 4 engine. #114

Closed
davidmles opened this issue Jun 1, 2014 · 14 comments
Closed

Comments

@davidmles
Copy link

Guard-minitest does not seem to work with spring in a Rails 4 engine.

Steps to reproduce it:

rails plugin new example --mountable
cd example/
echo "gem 'guard-minitest', group: :development" >> Gemfile
bundle
bundle exec guard init minitest
bundle exec guard

Here it runs the test/example_test.rb sample test successfully:

01:27:50 - INFO - Guard is using TerminalTitle to send notifications.
01:27:50 - INFO - Guard::Minitest 2.3.0 is running, with Minitest::Unit 5.3.4!
01:27:50 - INFO - Running: all tests
Run options: --seed 27937

# Running:

.

Finished in 0.004659s, 214.6383 runs/s, 214.6383 assertions/s.

1 runs, 1 assertions, 0 failures, 0 errors, 0 skips

01:27:52 - INFO - Guard is now watching at '/Users/david/Sites/example'

Now when editing Guardfile and changing guard :minitest do to guard :minitest, spring: true do, the test is not run anymore:

01:28:45 - INFO - Run all
01:28:45 - INFO - Running: all tests

Nothing is run.

  • Uncommenting the Rails 4 watches gives the same result.
  • Adding spring to the Gemfile does not help.
  • Stubbing spring into bins after creating this config/spring.rb file:
Spring.application_root = './test/dummy'

...does not help either.

@genericsteele
Copy link
Contributor

Interesting...I'll need to have a look at how Spring handles engines.

@aspiers
Copy link

aspiers commented Jun 14, 2014

Doesn't work for me either:

Using /home/adam/.rvm/gems/ruby-1.9.3-p392 with gemset myapp
19:11:57 - WARN - Guard::RSpec DEPRECATION WARNING: The :spring option is deprecated. Please customize the new :cmd option to fit your need.
19:11:57 - INFO - Guard is using Libnotify to send notifications.
19:11:57 - INFO - Guard is using Emacs to send notifications.
19:11:57 - INFO - Guard is using Tmux to send notifications.
19:11:57 - INFO - Guard is using TerminalTitle to send notifications.
19:11:57 - INFO - LiveReload is waiting for a browser to connect.
19:11:57 - INFO - Guard::Minitest 2.3.0 is running, with Minitest::Unit 4.7.5!
19:11:57 - INFO - Guard::RSpec is running
19:11:57 - INFO - Bundle already up-to-date
19:11:57 - INFO - Guard is now watching at '/home/adam/rails/myapp'

Frame number: 0/0
[1] guard(main)> minitest
19:12:00 - INFO - Run Minitest
19:12:00 - INFO - Running: all tests
Warning: You're using Rubygems 1.8.25 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all` for better startup performance.
Run options: -n spec/models/person_spec.rb --seed 5542

# Running tests:



Finished tests in 0.011478s, 0.0000 tests/s, 0.0000 assertions/s.

0 tests, 0 assertions, 0 failures, 0 errors, 0 skips
Coverage report generated for Functional Tests, RSpec to /home/adam/rails/myapp/coverage. 833 / 912 LOC (91.34%) covered.

@genericsteele
Copy link
Contributor

@davidmles I was able to get this working, but I need a sanity check. I needed the spring.rb config file pointing to the dummy app along with a change to the spring command. Can you try to run this again, but with spring: 'bundle exec spring rake test' as the spring command in the Guardfile? Also any output from bundle exec guard --debug would be helpful.

config/spring.rb

Spring.application_root = './test/dummy'

Guardfile

guard :minitest, spring: 'bundle exec spring rake test' do

@genericsteele
Copy link
Contributor

I have a hunch that there is some command gobbling up actual errors instead of raising them, which causes zero tests to be run here and #97.

I'd welcome any theories/suggestions/pull requests.

@szeryf
Copy link

szeryf commented Oct 28, 2014

Not sure if it helps anyone, but with Rails 4.1.6, it seems to work out of the box. I just added spring: true to my Guardfile and it worked. Correct tests are run when a file is modified and it does seem to start faster than without Spring.

My setup: Ruby 2.1, Rails 4.1.6, Guard 2.6.0, guard-minitest 2.3.2, Spring 1.1.3, minitest 5.4.2.

@sunnyrjuneja
Copy link

It also seems to be working fine with rails 4.2, ruby 2.1.5, Guard 2.10.5, guard-minitest 2.3.2, spring 1.2.0, and minitest 5.5.0. It might be okay to close this issue now.

@e2
Copy link
Contributor

e2 commented Dec 23, 2014

If anyone can create a GH repo reproducing this, I would look into it.

@bikramwp
Copy link

Just tested this in a Rails engine. Here is GH repo reproducing the problem
spring: 'bundle exec spring rake test' works
but spring: true does not work.

Versions in use:
rails-4.2.0
spring-1.2.0
minitest-5.5.1
guard-2.11.1
guard-minitest-2.3.2

@e2
Copy link
Contributor

e2 commented Jan 14, 2015

It's because bin/rake doesn't exist...

There should be a message in guard-minitest for this. I'll try and cook something up.

@e2
Copy link
Contributor

e2 commented Jan 15, 2015

I've released guard-minitest 2.4.2, which shows an error in this scenario (instead of a silent failure).

So, I'm closing this.

Let me know if there are any other issues.

@e2 e2 closed this as completed Jan 15, 2015
@e2
Copy link
Contributor

e2 commented Jan 15, 2015

@bikramwp - thanks so much for the repo to reproduce this. I wouldn't have worked this out without it.

@genericsteele
Copy link
Contributor

@e2 Good find and good fix. Thanks for picking this one back up.

@e2
Copy link
Contributor

e2 commented Jan 15, 2015

@genericsteele - I don't know if Errno::ENOENT is a good choice. But it was the least confusing that I could think of.

@duarme
Copy link

duarme commented Jul 11, 2015

For some reason this issue occurs if there is spec folder along with the test one. I was migrating from rspec to minitest and I was trying to solve this issue but I gave up. Anyway, as soon as I renamed the spec folder the issue was fixed... weird.

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

8 participants