Hello there I am new to rail. I am following railstutorial.org 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
/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'
application.html.erb
<!DOCTYPE html>
<html>
<head>
<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 %>
</head>
<body>
<%= yield %>
</body>
</html>
application_helper.rb
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?
base_title
else
page_title + " | " + base_title
end
end
end
static_pages_controller_test.rb
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"
end
test "should get help" do
get :help
assert_response :success
assert_select "title", "Help | Ruby on Rails Tutorial Sample App"
end
test "should get about" do
get :about
assert_response :success
assert_select "title", "About | Ruby on Rails Tutorial Sample App"
end
end
test_helper.rb
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require "minitest/reporters"
Minitest::Reporters.use!
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...
end
Gemfile
source 'https://rubygems.org'
gem 'rails', '4.2.6'
gem 'sass-rails', '5.0.2'
gem 'uglifier', '2.5.3'
gem 'coffee-rails', '4.1.0'
gem 'jquery-rails', '4.0.3'
gem 'turbolinks', '2.3.0'
gem 'jbuilder', '2.2.3'
gem 'sdoc', '0.4.0', group: :doc
group :development, :test do
gem 'sqlite3', '1.3.9'
gem 'byebug', '3.4.0'
gem 'web-console', '2.0.0.beta3'
gem 'spring', '1.1.3'
end
group :test do
gem 'minitest-reporters', '1.0.5'
gem 'mini_backtrace', '0.1.3'
gem 'guard-minitest', '2.3.1'
end
group :production do
gem 'pg', '0.17.1'
gem 'rails_12factor', '0.0.2'
end
Please guide me how can i get rid of the error.
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:
.ruby-version
Gemfile
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With