user88
user88

Reputation: 1164

you should require 'minitest/autorun' instead. in ruby on rails

I am creating an application on ruby on rails:

After creating users, for validating users I am running below commands:

$ bundle exec rake db:migrate
$ bundle exec rake test:prepare

Both command are run properly on the rails commandLine, but when I run the below command:

$ bundle exec rspec spec/models/user_spec.rb

I am getting error below:

Warning: you should require 'minitest/autorun' instead.
Warning: or add 'gem "minitest"' before 'require "minitest/autorun"'

And I am using 4.1.1 version of rails. I don't understand why it comes. Kindly suggest me, waiting for your reply. Thanks.

Upvotes: 11

Views: 5234

Answers (2)

Chris Nelson
Chris Nelson

Reputation: 145

More a note for posterity than anything, but this issue can also happen if you're using an older version of shoulda-matchers. You can see some discussion around this on their Github repo here, or on the rspec-rails repo here.

Update shoulda-matchers by running bundle update shoulda-matchers. You want the latest version (or at least 2.6.2) and this message should go away.

Upvotes: 13

cyborg
cyborg

Reputation: 878

Include minitest gem in your 'Gemfile' and run bundle install

gem install 'minitest'

and then bundle install

Upvotes: 7

Related Questions