Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Remove warning caused by changes in minitest 5 #772

Closed
wants to merge 7 commits into
from

Conversation

Projects
None yet
Contributor

vanstee commented Jun 18, 2013

Fixes the warning reading: "Warning: you should require
'minitest/autorun' instead."

Minitest 5 moved a few things around, such as the "MiniTest" to
"Minitest" module change, so those were updated as well.

Contributor

vanstee commented Jun 18, 2013

Ran into this running Rails 4.1.0.beta and Ruby 2.0.0-p195. This is also probably a fix for #758

Owner

samphippen commented Jun 18, 2013

@vanstee this mostly looks good to me. @alindeman will probably have opinions. For my 2c I think this needs to go into 2-14, 2-99 and 3. Andy do you agree?

Contributor

vanstee commented Jun 18, 2013

D'oh. This blows up on older ruby versions. Maybe I can wrap this stuff up nicely and switch depending on the ruby version. Thoughts?

Owner

samphippen commented Jun 18, 2013

@vanstee however it works we need to pass under 1.8.7. if you've got thoughts on how to do it then by all means go ahead!

Contributor

alindeman commented Jun 25, 2013

Is this ready to be reviewed again? Seems like there are still some Travis errors.

Thanks for looking into this, @vanstee.

Contributor

vanstee commented Jul 24, 2013

Oops. Sorry about not following up on this.

I was hoping we could just require minitest ~> 5.0 but that also seems to be throwing a few errors. I'll try to spend some time on it this week.

Create facade for switching assertion libraries
This is in preparation of requiring different testing libraries based on
the rails version.
Contributor

vanstee commented Jul 25, 2013

Well that's a start. Tests pass until you hit the same problem in cucumber. I'll clean some stuff up later and get this ready for merging.

Contributor

vanstee commented Jul 26, 2013

Yay! All the test failures seem to be unrelated and I'm no longer seeing the warning on master. @alindeman let me know if there's anything else I can do to clean this up.

Contributor

vanstee commented Jul 26, 2013

Oops I guess I should probably leave the require up at the top. Maybe this should all be hidden away in a separate file as well.

Contributor

alindeman commented Jul 27, 2013

Oops I guess I should probably leave the require up at the top. Maybe this should all be hidden away in a separate file as well.

Is this comment still relevant? If so, I need a bit more info on what you mean.

Contributor

alindeman commented Jul 27, 2013

Other than the one error caused by a rubygems.org timeout, any reason not to trust the all green here and merge? https://travis-ci.org/alindeman/rspec-rails/builds/9561178

I believe the one failure on master is Rails' fault. I might look into it sometime.

It's a bummer that this happens:

'4.0.0.beta' > '4' # => true

otherwise I could use change this line to:

::Rails::VERSION::STRING > '4'
Contributor

vanstee commented Jul 30, 2013

@alindeman I split out each adapter to clean things up. Let me know if the extra requires are something we should worry about. I can always remove those last two commits.

Contributor

bricker commented Aug 6, 2013

This pull request fixes more than just the warnings. Loading test/unit/assertions with minitest > 5.0 and ruby 1.9.3-p0 causes uninitialized constant Minitest::MINI_DIR. See rails/rails#11691 for more details.

Here is an example app to reproduce the failure: https://github.com/bricker/ruby-1.9.3-p0-failure

A new error occurrs when running the example app's specs with this patch (plus upgrading to rspec 3.0.0.pre), but it's unrelated. The uninitialized constant error goes away.

Contributor

alindeman commented Aug 9, 2013

I'm playing with this a bit, and I think it's close. I'll plan to have it merged in by the weekend, barring any big issues.

Thanks so much for getting this together @vanstee.

Contributor

vanstee commented Aug 9, 2013

@alindeman Thanks for the review. Let me know if there's anything I can do to clean it up. Wasn't sure if splitting up those adapter classes for readability was worth the extra requires or not.

Contributor

alindeman commented Aug 9, 2013

@alindeman Thanks for the review. Let me know if there's anything I can do to clean it up. Wasn't sure if splitting up those adapter classes for readability was worth the extra requires or not.

For now, I think I may leave out that commit. It makes thing a bit harder to find, and we have to be sensitive of the number of requires we do. It's easy enough to take out, so no worries.

alindeman added a commit to alindeman/rspec-rails that referenced this pull request Aug 10, 2013

alindeman added a commit to alindeman/rspec-rails that referenced this pull request Aug 13, 2013

Contributor

alindeman commented Aug 13, 2013

Merged with f4dd001. I will likely go back to 2.99 and maybe 2.14 with this.

If you get a sec, @vanstee, do you mind looking over it and making sure it works for you?

@alindeman alindeman closed this Aug 13, 2013

alindeman added a commit that referenced this pull request Aug 13, 2013

@vanstee vanstee deleted the vanstee:switch-from-test-unit-to-minitest branch Aug 13, 2013

alindeman added a commit that referenced this pull request Aug 13, 2013

Contributor

vanstee commented Aug 13, 2013

@alindeman Was only able to test with 2-14-maintenance due to some dependencies in other gems. Looks good 👍

gjaldon commented Dec 18, 2013

Experienced this same problem with Rails-4.1.0.beta. Just upgraded to it and am using Ruby 2.0.0p353. Wasn't experiencing this issue before the upgrade. However, if I require 'rspec/autorun' before require 'rspec/rails', the error/warning is silenced.

Contributor

vanstee commented Dec 18, 2013

@gjaldon Looks like @alindeman fixed this one but I don't think it's been released as part of 2.14.x yet. Although, you could give 2.99.0.beta1 or 3.0.0.beta1 a try. I've been using 2.99.0.beta1 for a couple of weeks without any issues.

gjaldon commented Dec 19, 2013

@vanstee thanks for the info. Will try that out. Btw, the warning isn't silenced when changing the order of requires. Wrong statement. :)

noahsw commented Dec 21, 2013

I get this warning only when I have gem 'shoulda-matchers' in my Gemfile. I'm using rspec-rails 3.0.0.beta1 with rails 3.2.12. Changing the order of require 'rspec/autorun' and require 'rspec/rails' did not have an effect.

pardel commented Dec 23, 2013

I can confirm @noahsw's scenario. It happens the moment I'm adding 'shoulda-matchers'.

Contributor

alindeman commented Dec 29, 2013

2.14.1 is released. Please open a new issue if there are still problems :)

Upgrading to 2.14.1 fixed it for me. Thanks!

@Soliah Soliah referenced this pull request in thoughtbot/shoulda-matchers Dec 30, 2013

Closed

Warning regarding minitest/unit when used with rails 4.1.0.beta1 #408

noahsw commented Dec 31, 2013

Hmm... I've been using 2.14.1 this whole time. It still has the issue.

RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.23
  - RUBY VERSION: 1.9.3 (2013-06-27 patchlevel 448) [x86_64-darwin12.4.0]

rails (3.2.12)
rspec (2.14.1)
rspec-collection_matchers (0.0.2)
rspec-core (3.0.0.beta1, 2.14.7)
rspec-expectations (3.0.0.beta1, 2.14.4)
rspec-mocks (3.0.0.beta1, 2.14.4)
rspec-rails (3.0.0.beta1)
rspec-support (3.0.0.beta1)
shoulda-matchers (2.4.0)

emaiax commented Jan 29, 2014

I'm still experiencing this issue.

My Gemfile.lock looks like this.

rails (4.1.0.beta1)
factory_girl (4.3.0)
rake (10.1.1)
rspec-core (2.14.7)
rspec-expectations (2.14.4)
  diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.4)
rspec-rails (2.14.1)
  actionpack (>= 3.0)
  activemodel (>= 3.0)
  activesupport (>= 3.0)
  railties (>= 3.0)
  rspec-core (~> 2.14.0)
  rspec-expectations (~> 2.14.0)
  rspec-mocks (~> 2.14.0)

jaredbeck added a commit to usgo/gocongress that referenced this pull request Feb 17, 2014

Fixes warning from minitest by updating rspec-rails
> Warning: you should require 'minitest/autorun' instead.

rspec/rspec-rails#772

@jaredbeck jaredbeck referenced this pull request in usgo/gocongress Feb 17, 2014

Merged

Fixes warning from minitest, by updating rspec-rails #10

zolzaya commented Feb 20, 2014

Same here :(

My environments:

Gems included by the bundle:
  * actionmailer (4.1.0.rc1)
  * actionpack (4.1.0.rc1)
  * actionview (4.1.0.rc1)
  * activemodel (4.1.0.rc1)
  * activerecord (4.1.0.rc1)
  * activesupport (4.1.0.rc1)
  * addressable (2.3.5)
  * admin (0.0.1)
  * arel (5.0.0)
  * atomic (1.1.14)
  * bcrypt-ruby (3.1.2)
  * bootstrap-sass (3.1.1.0)
  * builder (3.2.2)
  * bundler (1.3.5)
  * capistrano (3.1.0)
  * capistrano-bundler (1.1.2)
  * capistrano-rails (1.1.1)
  * capistrano-rvm (0.1.1)
  * capybara (2.2.1)
  * celluloid (0.15.2)
  * coderay (1.1.0)
  * coffee-rails (4.0.1)
  * coffee-script (2.2.0)
  * coffee-script-source (1.6.3)
  * database_cleaner (1.2.0)
  * delayed_job (4.0.0)
  * delayed_job_active_record (4.0.0)
  * diff-lcs (1.2.5)
  * docile (1.1.2)
  * em-websocket (0.5.0)
  * erubis (2.7.0)
  * eventmachine (1.0.3)
  * execjs (2.0.2)
  * factory_girl (4.4.0)
  * factory_girl_rails (4.4.0)
  * ffaker (1.23.0)
  * ffi (1.9.3)
  * formatador (0.2.4)
  * guard (2.3.0)
  * guard-livereload (2.1.1)
  * guard-rspec (4.2.2)
  * hike (1.2.3)
  * http_parser.rb (0.5.3)
  * i18n (0.6.9)
  * jbuilder (1.5.3)
  * jquery-rails (3.1.0)
  * json (1.8.1)
  * kaminari (0.15.1)
  * launchy (2.4.2)
  * listen (2.4.0)
  * lumberjack (1.0.4)
  * mail (2.5.4)
  * method_source (0.8.2)
  * mime-types (1.25.1)
  * mini_portile (0.5.2)
  * minitest (5.2.3)
  * multi_json (1.8.4)
  * net-scp (1.1.2)
  * net-ssh (2.8.0)
  * nokogiri (1.6.1)
  * pg (0.17.1)
  * polyglot (0.3.4)
  * pry (0.9.12.6)
  * rack (1.5.2)
  * rack-test (0.6.2)
  * rails (4.1.0.rc1)
  * railties (4.1.0.rc1)
  * rake (10.1.1)
  * rb-fsevent (0.9.4)
  * rb-inotify (0.9.3)
  * rspec (3.0.0.beta1)
  * rspec-collection_matchers (0.0.3)
  * rspec-core (3.0.0.beta1)
  * rspec-expectations (3.0.0.beta1)
  * rspec-mocks (3.0.0.beta1)
  * rspec-rails (3.0.0.beta1)
  * rspec-support (3.0.0.beta1)
  * sass (3.2.13)
  * sass-rails (4.0.1)
  * shoulda-matchers (2.5.0)
  * simplecov (0.8.2)
  * simplecov-html (0.8.0)
  * slop (3.4.7)
  * spring (1.1.1)
  * spring-commands-rspec (1.0.1)
  * sprockets (2.10.1)
  * sprockets-rails (2.0.1)
  * sshkit (1.3.0)
  * term-ansicolor (1.3.0)
  * thor (0.18.1)
  * thread_safe (0.1.3)
  * tilt (1.4.1)
  * timers (1.1.0)
  * tins (1.0.0)
  * treetop (1.4.15)
  * turbolinks (2.2.1)
  * tzinfo (1.1.0)
  * uglifier (2.4.0)
  * warden (1.2.3)
  * xpath (2.0.0)
Owner

JonRowe commented Feb 20, 2014

@zolzaya @emaiax can one of you produce an isolated example of this? (Create a new empty rails app and use your current gemfile.lock, check it raises the error and then push it to a gh repo)

zolzaya commented Feb 20, 2014

@JonRowe Okay give me a minute

zolzaya commented Feb 20, 2014

@JonRowe OMG it's working without warning in new rails application. But I got same warning in my old application. Hmm ..................

If you're still getting this error there's a chance it could be shoulda-matchers - if I add require: false to my shoulda reference in my Gemfile, the error is silenced.

tuomasj commented Feb 23, 2014

Thanks @dpickett, it silences the error. I'm running Rails 4.1.0.rc1 and RSpec 3.0.0.beta2

gem 'shoulda', require: false

shoota added a commit to shoota/rails-tutorial that referenced this pull request Jun 16, 2014

update gem rspec-rails from v2.13.1 to 2.14.1
minitest5の変更のためか、rails 4.1でrspec 2.13.1だとwarnがでるらしい。
@see rspec/rspec-rails#772

shoota added a commit to shoota/rails-tutorial that referenced this pull request Jun 16, 2014

update gem rspec-rails from v2.13.1 to 2.14.1
minitest5の変更のためか、rails 4.1でrspec 2.13.1だとwarnがでるらしい。
@see rspec/rspec-rails#772

Thanks @dpickett ! Worked for me as well.

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