Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add gem 'minitest' to my test helper?

I am new to Ruby on Rails and testing. When I run rake test I get the following error:

/Users/jarvis/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rack-1.3.4/lib/rack/backports /uri/common_192.rb:53: warning: already initialized constant WFKV_ /Users/jarvis/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/turn-0.8.3/lib/turn/autorun /minitest.rb:14:in `<top (required)>': MiniTest v1.6.0 is out of date. (RuntimeError) `gem install minitest` and add `gem 'minitest' to you test helper.     from /Users/jarvis/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/activesupport-3.1.1/lib /active_support/dependencies.rb:240:in `require' 

I did gem install minitest and now it says to add gem 'minitest' to my test helper. Is this test/test_helper.rb, and if so, how do I "add" minitest?

like image 490
Nick Ruta Avatar asked Oct 15 '11 17:10

Nick Ruta


People also ask

How do you run a Minitest test?

To run a Minitest test, the only setup you really need is to require the autorun file at the beginning of a test file: require 'minitest/autorun' . This is good if you'd like to keep the code small. A better way to get started with Minitest is to have Bundler create a template project for you.

Is Minitest part of Ruby?

Minitest is a testing tool for Ruby that provides a complete suite of testing facilities. It also supports behaviour-driven development, mocking and benchmarking. With the release of Ruby 1.9, it was added to Ruby's standard library, which increased its popularity.


2 Answers

Edit your Gemfile so that the gem is specified under the test group, like so:

group :test do   gem "minitest" end 

(Posting the solution that the OP edited into the question, but did not post as an answer)

like image 173
thomasfedb Avatar answered Sep 23 '22 03:09

thomasfedb


uninstall your minitest first. gem uninstall minitest.

if you are using turn make sure the version is less 0.8.3

put those code to your bottom of your Gemfile

group :test do   gem 'turn', '< 0.8.3'   gem 'minitest' end 

then run

bundle install  
like image 30
alexzg Avatar answered Sep 22 '22 03:09

alexzg