Like the headline said, I am getting the aforementioned error when I try to run my rspec tests. The exact error is (word wrapped for readability):
/.rvm/gems/ruby-1.9.3-p374/gems/test-unit-2.4.8/lib/test/unit/testcase.rb:93:in
`<class:TestCase>': uninitialized constant
Test::Unit::TestCase::Assertions (NameError)
The main fix for this problem on the internet seems to be to remove the 'turn' gem, however I don't have the turn gem loaded. Here is my Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.8'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'devise'
gem 'therubyracer'
gem 'mysql2'
gem 'cucumber'
gem 'email_spec'
gem 'cancan'
gem 'rolify'
gem 'libv8'
gem 'simple_form'
group :test, :development do
gem 'rspec-rails'
gem 'factory_girl_rails'
gem 'test-unit'
end
group :test do
gem 'cucumber-rails', :require => false
gem 'capybara'
gem 'database_cleaner'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'coffee-rails', '~> 3.2.1'
gem 'bootstrap-sass'
gem 'sass-rails', '~> 3.2.3'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
The part of my code that the test seems to be choking on is when I have this line in my require 'rspec/rails' in my rspec_helper.rb file.
This project used to run rspecs flawlessly. It's only when I did a reinstall of my OS that it began to behave badly.
Any help is greatly appreciated
Since your are not generating a new app, remove the line
gem 'test-unit'
from your Gemfile and remove the gems turn and minitest, followed by a bundle update.
Answer: If you look in my Gemfile, you see a requirement in my group :test, :development for gem 'test-unit'. I commented that out and it works like a charm. Why and how this works I have no idea, if someone would mind explaining go right ahead.
Related
Everytime I run a heroku command I receive this error:
Your Ruby version is 1.9.3, but your Gemfile specified 2.1.2
This has been happening since I pushed several changes (adding sidekiq and making changes to my clock.rb file, also: a new model I need to migrate the db for)
Does anyone know why this might be happening? It only started after I added ruby '2.1.2' to the gemfile. But before that I was getting this funky segmentation fault error.
Here's my gemfile:
source 'https://rubygems.org'
ruby '2.1.2'
gem 'rails', '4.1.1'
gem 'pg'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'clockwork'
gem 'httparty'
gem 'omniauth-facebook'
gem 'parse-ruby-client'
gem 'parse_resource', '~> 1.8.0'
gem 'stripe', :git => 'https://github.com/stripe/stripe-ruby'
gem 'sidekiq'
gem 'foundation-rails'
group :development, :test do
gem 'pry-rails'
gem 'rspec-rails'
gem 'factory_girl_rails'
gem 'shoulda-matchers'
gem 'valid_attribute'
gem 'capybara'
gem 'dotenv-rails'
gem 'better_errors'
gem 'binding_of_caller'
end
group :production do
gem 'rails_12factor'
gem 'thin'
end
It's seems to related bundler issue. Go through here https://github.com/sstephenson/rbenv/issues/400 same sort of issue also here get fixed with :
# Rakefile
task :freedom do
Bundler.with_clean_env { sh "heroku" }
end
Hope this help you!
I had two applications using Ruby. In your terminal, change to the directory of the application, then check the Ruby version you are using. Update it appropriately.
When I type this, everything works :
set rails_env=development
rspec spec/models/foo.rb
When I type this, my program get stuck with a deprecation warning :
set rails_env=test
rspec spec/models/foo.rb
->Rack::File headers parameter replaces cache_control after Rack 1.5.
I really need to launch my tests with rails_env=test Do you know what is going on?
Useful infos :
C:\dev>ruby --version
ruby 1.9.3p385 (2013-02-06) [i386-mingw32]
C:\dev>rails --version
Rails 3.2.12
My Gemfile :
source 'https://rubygems.org'
gem 'rails', '3.2.12'
gem 'sqlite3'
gem 'delayed_job_active_record', '= 0.3.3'
gem 'delayed_job', '= 3.0.5'
gem 'clockwork'
gem 'dj_mon'
gem 'libxml-ruby'
gem 'haml-rails'
gem 'log4r'
gem 'spreadsheet'
gem 'mail'
gem "axlsx", "= 2.0.0"
gem 'axlsx_rails'
gem 'ruby-prof'
gem 'test-unit', :require => "test/unit"
gem 'ruby-oci8', '= 2.1.4'
gem 'pg', :require => 'pg'
gem 'devise', '<= 2.2.3'
gem 'cancan', '<= 1.6.9'
gem 'validates_timeliness'
gem 'will_paginate'
gem 'nokogiri'
gem 'simplecov'
gem 'google_visualr'
gem 'thin'
gem 'workflow'
gem 'ruby-graphviz'
gem 'ruby-odbc'
gem 'rubyzip', "= 0.9.9"
gem "rspec-deep-ignore-order-matcher"
gem 'rspec'
gem 'awesome_print'
gem 'syntax'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails', '2.3.0'
group :test, :development do
gem "rspec-rails", "~> 2.0"
end
Update :
I updated my rails version to 3.2.13. The warning disapeared but my app is still stuck.
Update to rails 3.2.13 -- this was a bug fixed
https://github.com/rails/rails/pull/8812
Scroll to the bottom for the closed marker to see the note.
Fixed thanks to koffeinfre.
My test database config had a typo and I didn't know that I had logs into log/test.log.
Also, thanks to trh and Peter Alfvin for pointing out that the deprecation warning was fixed in rails 3.2.13.
I'm trying to install bootstrap-sass-rails. I copied this line: gem 'bootstrap-sass-rails' into the assets group. I ran bundle install. I followed the directions on the README exactly, but Sass complained that it couldn't find 'twitter/bootstrap' - I fiddled around a bit with locating the file and then...
Here comes the confusing part -- the gem was installed fine (or so Bundler said). But now there's nothing in my /vendor/assets/stylesheets directory! I checked git status and no new Sass files (or anything else really) was changed except app/assets/stylesheets/application.css.scss and app/assets/javascripts/application.js! I thought maybe that gem was broken, but the same thing happened with bootstrap-sass.
Why aren't my gems being installed correctly?
Full Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.12'
gem 'bson_ext'
gem 'nokogiri'
gem 'execjs'
gem 'therubyracer'
gem 'rb-readline', '~> 0.4.2'
gem 'jquery-rails'
gem 'simple_form'
gem 'mysql2'
gem 'chronic'
gem 'prawn-labels'
gem 'draper'
gem 'ruby-aaws'
gem 'bcrypt-ruby'
gem 'sass-rails', '~> 3.2'
group :assets do
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
gem 'bootstrap-sass-rails'
end
group :development do
gem 'better_errors'
gem 'binding_of_caller'
gem 'quiet_assets'
gem 'thin'
end
group :development, :test do
gem 'bourne'
gem 'rspec-rails'
gem 'pry'
gem 'pry-doc'
gem 'pry-debugger'
gem 'pry-rails'
gem 'faker'
gem 'pdf-inspector'
gem 'guard-rspec'
gem 'guard-zeus'
gem 'guard-livereload'
gem 'debugger'
gem 'rb-fsevent' if RUBY_PLATFORM =~ /darwin/i
if RUBY_PLATFORM =~ /linux/i then
gem 'rb-inotify' # Filesystem changes
gem 'libnotify' # Desktop notifications
end
end
group :test do
gem 'factory_girl_rails'
end
For "bootstrap-sass-rails" gem, the actual js and css files are located in gem's directory. They won't be copied to /vendor. And other gems do the same unless they provide a special generate task.
These directories will be included in assets' path. So when you mention #import bootstrap, Rails know where to search the files.
When running autotest, I get the error Could not find ZenTest-4.7.0 in any of the sources. After viewing this article, I deleted gemfile.lock, ran 'bundle install', and then tried rerunning autotest. Now I get the error Could not find rake-10.0.3 in any of the sources. FYI, I am using RBENV, and I have no other problems running my app (rails c, rails s, rake, ...). Here is my gem file (btw, both "missing" files appeared in gemfile.lock):
source 'http://rubygems.org'
gem 'rails', '3.1.3'
gem 'rake'
gem 'pg', '0.13.2'
# Sidekiq handles background jobs, using threading
gem 'sidekiq', '>= 2.6.1'
# Need the following gems for sidekiq/web
gem 'slim'
# if you require 'sinatra' you get the DSL extended to Object
gem 'sinatra', :require => nil
gem 'heroku-api' # Need the API for scaling sidekiq
gem 'json'
gem 'premailer'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '3.1.4'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# Bundle the extra gems:
gem 'mechanize'
gem 'nokogiri'
gem 'spreadsheet'
gem 'xml-simple'
gem 'faker', '~> 0.3.1'
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
group :development do
gem 'rspec-rails'
gem 'ruby-debug19'
end
group :test do
gem 'rspec-rails'
gem 'ZenTest'
gem 'shoulda-matchers'
gem 'webrat', '0.7.1'
gem 'factory_girl_rails'
gem 'ruby-debug19'
end
gem 'geoip'
gem 'thin'
gem 'htmlentities'
I'm not 100% certain, but I think you just do:
gem install ZenTest
and probably
gem install autotest-rails
From within your application directory.
These guys are not managed by your gemfile and bundler
I'm going through the Rails 3 in Action eBook and they've put a lot of emphasis on testing but I can't seem to get Cucumber to work for some reason.
I keep getting a Rake aborted! Stack level too deep error when I use to rake cucumber:ok command.
Anyone know what might be causing this?
Here's my gem file:
source 'http://rubygems.org'
gem 'rails', '3.1.1.rc1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
group :test, :development do
gem 'rspec-rails', '~> 2.5'
end
group :test do
gem 'cucumber-rails'
gem 'capybara'
gem 'database_cleaner'
end
Use
bundle exec rake cucumber:ok