Shyam Bhimani Shyam Bhimani - 2 years ago 142
Ruby Question

bundle exec rake test throwing error

Hello there I am new to rail. I am following by Michael Hartl. I am stuck in chapter 4, Listing 4.5:
when i hit

$ bundle exec rake test
it showing some different result than it supposed to show as per tutorial.
Note :I am using Ubuntu 15.10 as a platform.

Result when i hit
$ bundle exec rake test

RubyDep: WARNING: your Ruby has security vulnerabilities! Please upgrade! (To disable warnings, set RUBY_DEP_GEM_SILENCE_WARNINGS=1)
/home/shyambhimani/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/minitest-reporters-1.0.5/lib/minitest/minitest_reporter_plugin.rb:8:in `block in plugin_minitest_reporter_init': undefined method `add_defaults' for #<Guard::Minitest::Reporter:0x005580a1496930> (NoMethodError)
from /home/shyambhimani/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/minitest-reporters-1.0.5/lib/minitest/minitest_reporter_plugin.rb:6:in `each'
from /home/shyambhimani/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/minitest-reporters-1.0.5/lib/minitest/minitest_reporter_plugin.rb:6:in `plugin_minitest_reporter_init'
from /home/shyambhimani/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/minitest-5.8.4/lib/minitest.rb:74:in `block in init_plugins'
from /home/shyambhimani/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/minitest-5.8.4/lib/minitest.rb:72:in `each'
from /home/shyambhimani/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/minitest-5.8.4/lib/minitest.rb:72:in `init_plugins'
from /home/shyambhimani/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/minitest-5.8.4/lib/minitest.rb:123:in `run'
from /home/shyambhimani/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/minitest-5.8.4/lib/minitest.rb:56:in `block in autorun'


<!DOCTYPE html>
<title><%= full_title(yield(:title)) %></title>
<%= stylesheet_link_tag 'application', media: 'all',
'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
<%= yield %>


module ApplicationHelper

# Returns the full title on a per-page basis.
def full_title(page_title = '')
base_title = "Ruby on Rails Tutorial Sample App"
if page_title.empty?
page_title + " | " + base_title


require 'test_helper'

class StaticPagesControllerTest < ActionController::TestCase
test "should get home" do
get :home
assert_response :success
assert_select "title", "Ruby on Rails Tutorial Sample App"

test "should get help" do
get :help
assert_response :success
assert_select "title", "Help | Ruby on Rails Tutorial Sample App"

test "should get about" do
get :about
assert_response :success
assert_select "title", "About | Ruby on Rails Tutorial Sample App"


ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require "minitest/reporters"

class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical
# order.
fixtures :all

# Add more helper methods to be used by all tests here...

Please guide me how can i get rid of the error.
Do not bother about Warning part I know I can remove warning by upgrading my
version as well as

Answer Source

It seems like you are using RubyDep, a tool that helps you to avoid insecure Ruby versions. RubyDep tells you in the first line:

RubyDep: WARNING: your Ruby has security vulnerabilities! Please upgrade! (...)

Looking at the path (.../.rbenv/versions/2.2.3/...) of the other lines of the stacktrace it looks like you are using Ruby version 2.2.3, installed with rbenv.

And RubyDep is right: There is a known vulnerability in Ruby 2.2.3.

There are newer versions of Ruby available. You could upgrade to the latest 2.2.x version (or the latest 2.3.x). I suggest to upgrade to 2.2.5, because I'm do not know if the tutorial is compatible with 2.3.x.

To upgrade Ruby to a newer version with rbenv follow this steps (I suppose you used brew to install rbenv):

brew update               # update to the latest brew version
brew upgrade ruby-build   # update Ruby version library
brew upgrade rbenv        # update rbenv
rbenv install 2.2.5       # install Ruby 2.2.5

Set 2.2.5 to you default Ruby version:

rbenv global 2.2.5

Update your Rails application to use this Ruby version. To do so check the following files (if they exist, they might be hidden) and change the Ruby version in that files:


You might want to check in your applications root that you are using the updated version of Ruby:

ruby -v                   # should return `ruby 2.2.5p...`

Last step is to reinstall gems:

gem install bundler
bundler install

Was the update successful?

bundle exec rake test
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download