Hi I have created a test case in spec/myprocess as follows
before :each do
#my_base = MyBase.new
end
describe "new_my_base" do
it "should not take any arguments and retuens a MyBase object" do
#my_base.should be_an_instance_of MyBase
end
end
describe "#my_path" do
it "returns the correct mybase file path" do
$path.should eql App::Application.config.my_encode_type.to_s
end
end
and when I tun rspec spec/lib/mybasetest.rb it throws me the following error.
kalanamith#kalanamith:~/Documents/projects/leena$ rspec spec/lib/mybasetest.rb
*** Mocha deprecation warning: Change `require 'mocha'` to `require 'mocha/setup'`.
/var/lib/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require': iconv will be deprecated in the future, use String#encode instead.
*** Mocha deprecation warning: `require 'mocha/standalone'` has been deprecated. Please use `require 'mocha/api' instead.
/var/lib/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- mocha/object (LoadError)
/home/kalanamith/Documents/projects/fakturabank/spec/lib/mybasetest.rb:4:in `<top (required)>': undefined method `before' for main:Object (NoMethodError)
from /var/lib/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:746:in `load'
from /var/lib/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:746:in `block in load_spec_files'
from /var/lib/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:746:in `map'
from /var/lib/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:746:in `load_spec_files'
from /var/lib/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:22:in `run'
from /var/lib/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:69:in `run'
from /var/lib/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:10:in `block in autorun'
This is my gem file
source 'https://rubygems.org'
gem 'rails', '3.2.13'
gem 'jquery-rails' , '3.0.0'
gem 'pg'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
group :development, :test do
gem 'rails-dev-tweaks', '~> 0.6.1'
gem 'debugger'
gem 'rspec-rails', '2.10.0'
gem 'annotate'
gem 'factory_girl_rails'
gem 'shoulda-matchers'
gem 'simplecov', :require => false
gem 'simplecov-rcov', :require => false
gem 'pry'
gem "guard-rspec"
end
group :test do
gem 'mocha'
end
group :test do
gem "webmock"
end
gem 'debugger' # This gem works with ruby 1.9.3 it wraps these other things
gem 'savon', "~> 1.2.0"
gem 'airbrake'
gem 'aasm'
gem 'paranoia'
gem 'acts_as_tree'
gem 'will_paginate'
gem 'translate-rails3'
gem 'wicked_pdf'
gem 'activemerchant'
gem 'libxml-ruby'
gem 'libxslt-ruby'
gem 'ruby-xslt'
gem 'exception_notification', :require => 'exception_notifier'
gem "uuidtools", "~> 2.1.3"
gem "ruby-filemagic"
gem "rmagick", :require => false
gem "rubyzip"
gem "spreadsheet"
gem "multi_json"
gem "multi_xml"
gem "httparty"
#FormBuilder backwards compatibility
gem "dynamic_form"
gem "prototype-rails"
gem "formtastic"
gem "net-ssh"
gem "net-scp"
Um quite new to rails and this is my first experience with rspec framework . I will be grateful if anyone can assist me. Thank you in advance
There must be a "describe" that wraps before :each do
describe "Bla bla" do
before :each do
#my_base = MyBase.new
end
etc...
end
Anyway, the file name should be suffixed with _spec.rb
The before block should be inside the describe method
If you're using RSpec the end of the file must be suffixed with _spec.rb
Example: my_base_spec.rb
To Run: bundle exec rspec spec/my_base_spec.rb or simply bundle exec rspec
Related
I'm not actually a ruby dev, I'm just trying to get development environment setup from a project and I'm having a world of trouble getting the gems in order so I can load up the server. I do mostly front-end work. Anyways, my error is:
There was an error while trying to load the gem 'ahoy_matey'.
Gem Load Error is: undefined method `hours' for 4:Fixnum
I've been searching google for last two days and can't come across anyone experiencing this issue with "ahoy_matey" gem. I get this error when trying to launch the server or rake migrations.
Ruby 1.9.3
Rails 3.2.13
mysql2 0.3.17
Any help is appreciated.
Full trace:
Bundler::GemRequireError: There was an error while trying to load the gem 'ahoy_matey'.
Gem Load Error is: undefined method `hours' for 4:Fixnum
Backtrace for gem load error is:
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/ahoy_matey-1.1.0/lib/ahoy.rb:43:in `'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/ahoy_matey-1.1.0/lib/ahoy.rb:39:in `'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/ahoy_matey-1.1.0/lib/ahoy_matey.rb:1:in `require'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/ahoy_matey-1.1.0/lib/ahoy_matey.rb:1:in `'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:86:in `require'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:86:in `block (2 levels) in require'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:81:in `each'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:81:in `block in require'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:70:in `each'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:70:in `require'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/bundler-1.12.1/lib/bundler.rb:102:in `require'
/home/sirtastic/projects/dataraptor/config/application.rb:7:in `'
/home/sirtastic/projects/dataraptor/Rakefile:5:in `require'
/home/sirtastic/projects/dataraptor/Rakefile:5:in `'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/rake-11.1.2/lib/rake/rake_module.rb:28:in `load'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/rake-11.1.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/rake-11.1.2/lib/rake/application.rb:689:in `raw_load_rakefile'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/rake-11.1.2/lib/rake/application.rb:94:in `block in load_rakefile'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/rake-11.1.2/lib/rake/application.rb:93:in `load_rakefile'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/rake-11.1.2/lib/rake/application.rb:77:in `block in run'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/rake-11.1.2/lib/rake/application.rb:75:in `run'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/rake-11.1.2/bin/rake:33:in `'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/bin/rake:23:in `load'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/bin/rake:23:in `'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/bin/ruby_executable_hooks:15:in `eval'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/bin/ruby_executable_hooks:15:in `'
Bundler Error Backtrace:
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:90:in `rescue in block (2 levels) in require'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:85:in `block (2 levels) in require'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:81:in `each'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:81:in `block in require'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:70:in `each'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:70:in `require'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/gems/bundler-1.12.1/lib/bundler.rb:102:in `require'
/home/sirtastic/projects/dataraptor/config/application.rb:7:in `'
/home/sirtastic/projects/dataraptor/Rakefile:5:in `require'
/home/sirtastic/projects/dataraptor/Rakefile:5:in `'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/bin/ruby_executable_hooks:15:in `eval'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551#dr/bin/ruby_executable_hooks:15:in `'
(See full trace by running task with --trace)
source 'http://rubygems.org'
gem 'rails', '3.2.13'
gem 'mysql2'#, '~> 0.3.11'
gem 'sass-rails', '~> 3.2.3' # Because SCSS is compiled for embedded quoters
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', :platforms => :ruby
gem 'execjs', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails', '~> 3.0.4'
gem 'jquery-ui-rails', '~> 4.0.5'
gem 'jquery_datepicker'
group :production do
gem 'pry', require:false
end
group :development, :test do
gem 'capybara', :require => false
gem 'database_cleaner', :require => false # for use with capybara tests
gem 'factory_girl', '~> 4.1' # for generating test models
gem 'factory_girl_rails', require:false
gem 'forgery' # for generating test data
gem 'pry'
gem 'pry_debug'
gem 'pry-nav'
gem 'spork-rails', platform: [:mswin, :mingw] # Fast rpsec testing on Windows
#### DON'T JUST ADD GEMS TO THE END OF THIS LIST! ALPHABETIZE! ###
end
group :development do
gem 'thin' # Sane development server
gem 'bullet' # for identifying areas to speed up database queries
gem 'meta_request' # for chrome rails-panel
gem 'rack-mini-profiler', require:false
#### DON'T JUST ADD GEMS TO THE END OF THIS LIST! ALPHABETIZE! ###
end
group :test do
gem 'launchy', :require => false
gem 'rspec-rails'
gem "selenium-webdriver", "~> 2.40.0" # for AJAX testing
gem 'shoulda', :require => false
gem 'simplecov', :require => false # Test coverage
gem 'timecop'
gem 'vcr', '~> 2.9.3'#'~> 2.5.0'
gem "webmock", '~> 1.10.2'
#### DON'T JUST ADD GEMS TO THE END OF THIS LIST! ALPHABETIZE! ###
end
group :dev, :release, :development do
gem 'better_errors'
gem 'binding_of_caller' # supports better errors by providing IDE in browser when error occurs
end
gem 'activeuuid', '>= 0.5.0'
gem 'ahoy_matey', '1.1.0' #needs this exact version in order to output UUIDs consistently. the next version after does not.
gem 'american_date' # by default, dates are parsed/formatted with American style
gem 'angularjs-rails', '~> 1.0.7'
gem 'attr_encrypted', '~> 1.2' # encrypt activerecord attributes in db
gem 'authlogic', '~> 3.2' # user login
gem 'aws-sdk'
gem 'capistrano', require: false# deployment of application
gem 'capistrano-ext', require: false
gem 'carrierwave' # file upload solution
gem 'daemons' # used for running delayed_job jobs
gem 'encryptor', '~> 1.1' # handle encryption of ActiveRecord fields
gem 'exception_notification', '~> 4.0.0'
gem 'faraday' # REST client for interfacing with external APIs
gem 'faraday_middleware'
gem 'fog', '~> 1.22' # for Amazon Web Services cloud storage
gem 'formatador', '~> 0.2' # This shouldn't need to be here. It is/was a dependency for fog-core, but it wasn't getting bundled (for some reason), so raking assets:precompile consistently failed. 2014-09-17.
gem 'haml', '~> 4.0.3'
gem 'holidays', '~> 2.1.0'
gem 'httpi', '~> 2.2.7'
gem 'json', '~> 1.8.1' # Specified so as to 'safely' conduct an update for the sake of stripe gem (2014-05-21)
gem 'liquid', '~> 2.5.0' # rendering templates, such as Marketing::Email::Template
gem 'mini_magick' # photo resizing
gem 'momentjs-rails'
gem 'multi_xml'
gem 'paperclip', '~> 3.5.0' # handle file attachments to activerecord
gem "paypal-recurring"
gem 'nested_form'
gem 'rails3-jquery-autocomplete'# supports autocomplete fields
gem 'redis' # for publishing
gem 'remotipart', '~> 1.0' # enables multipart form submissions over ajax
gem 'ruby-saml', '~> 1.0.0'
gem 'rvm-capistrano', require: false # for deploying to servers where multiple rubies are available
gem 'safe_attributes' # takes care of attribute name collisions w/ ActiveRecord (we use 'delay')
gem 'savon', '~> 2.7'
gem "select2-rails" # makes an autocomplete select box, compatible with x-editable
gem 'sidekiq', '~> 2.17.0' # handles background/delayed jobs
gem 'spreadsheet', require: false
gem "stripe", '~> 1.11.0'
gem 'tinymce-rails', '>= 4.0.8' # version 4.0.8 includes important bug fixes
gem 'transaction_retry' # Catch mysql deadlock and try again
gem 'tzip', '~> 0.0.4' # Find timezone by zip code
gem 'whenever', require: false # handles scheduled tasks
gem 'wicked_pdf' # creates pdfs from html (is a wrapper for wkhtmltopdf)
gem 'will_paginate', '~> 3.0' # paginates index pages for activerecord
gem 'wkhtmltopdf-binary' # the backend linux tool that creates pdfs from html using QT Webkit rendering engine
#### DON'T JUST ADD GEMS TO THE END OF THIS LIST! ALPHABETIZE! ###
Looks like you might be requiring your bundle before requiring rails. If you have these two lines in your application.rb file, they need to be in this order:
require 'rails/all'
Bundler.require(:default, Rails.env)
So I see you're running just rails s. I know this question is old but maybe this might help someone else. So the command you want to be running is:
bundle exec rails s
bundle exec executes a command in the context of the bundle.
This command executes the command, making all gems specified in the Gemfile available to require in Rails.
Essentially, if you would normally have run something like rspec spec/my_spec.rb, and you want to use the gems specified in the Gemfile and installed via bundle install, you should run bundle exec rspec spec/my_spec.rb.
Note that bundle exec does not require that an executable is available on your shell's $PATH.
Source
We are upgrading our Rails app from 4.1 to 4.2.
While this code works great in 4.0 and 4.1:
admin_root_url(:subdomain => 'www')
When I try it on 4.2.3 I get this error:
ArgumentError: wrong number of arguments (3 for 1..2)
I checked it several time in console, running this code:
include Rails.application.routes.url_helpers
default_url_options[:host] = "localhost"
root_url
Our Gemfile looks like this:
source 'https://rubygems.org'
ruby "2.1.2"
gem 'rails', '4.2.4'
gem 'rake', "~> 10.2.2"
group :development do
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Generates model and controller UML diagrams
gem 'railroady'
gem 'bullet'
gem 'web-console', '~> 2.0'
end
group :staging, :production do
gem 'pg'
gem 'rails_12factor'
gem 'newrelic_rpm'
end
gem 'sass-rails', '~> 4.0.0'
gem 'less-rails-bootstrap'
gem 'uglifier', '>= 1.3.0'
gem 'yui-compressor'
gem 'coffee-rails', '~> 4.0.0'
gem 'therubyracer', platforms: :ruby
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
gem 'simple_form', '~> 3.1.0'
gem "paperclip", "~> 4.2"
gem 'aws-sdk'
gem 'devise', '~> 3.5.2'
gem "cancan"
gem 'friendly_id', '~> 5.0.2'
gem 'pusher', '~> 0.14.5'
gem "configurable_engine", :path => "vendor/gems/configurable_engine"
gem 'backbone-rails'
gem 'marionette-rails'
gem "breadcrumbs_on_rails"
gem 'subdomain-fu', :git => "git://github.com/mbleigh/subdomain-fu.git"
gem 'bitly'
gem 'social-share-button', '~> 0.1.8'
gem 'momentjs-rails', '~> 2.5.0'
gem 'bootstrap3-datetimepicker-rails', '~> 3.0.0'
gem 'rails_autolink'
gem 'jquery-datatables-rails', github: 'rweng/jquery-datatables-rails'
gem "twitter"
gem 'unicorn'
gem 'i18n-js', '>= 3.0.0.rc11'
gem 'sitemap_generator'
gem 'will_paginate-bootstrap'
group :test, :development, :staging do
gem 'populator'
gem 'faker'
end
gem "jquery-fileupload-rails"
gem 'rails-timeago', '~> 2.0'
gem 'font-awesome-rails'
gem 'omniauth'
gem 'omniauth-twitter'
gem 'omniauth-facebook'
gem 'jquery-minicolors-rails'
gem 'htmlentities', '~> 4.3.2'
gem 'sanitize'
gem 'nokogiri'
gem 'dalli'
gem 'kgio', '~> 2.9.3'
gem 'useragent'
gem "fog", "~>1.20"#, require: "fog/aws/storage"
gem 'asset_sync'
gem 'responders', '~> 2.0'
gem 'rails-deprecated_sanitizer'
================ edit ===============
Stack-trace in console:
ArgumentError: wrong number of arguments (3 for 1..2)
from /home/guy/.rvm/gems/ruby-2.1.2/bundler/gems/subdomain-fu-3752799a02c0/lib/subdomain_fu/url_rewriter.rb:6:in `url_for_with_subdomains'
from /home/guy/.rvm/gems/ruby-2.1.2/gems/actionpack-4.2.4/lib/action_dispatch/routing/route_set.rb:282:in `call'
from /home/guy/.rvm/gems/ruby-2.1.2/gems/actionpack-4.2.4/lib/action_dispatch/routing/route_set.rb:225:in `call'
from /home/guy/.rvm/gems/ruby-2.1.2/gems/actionpack-4.2.4/lib/action_dispatch/routing/route_set.rb:347:in `block (2 levels) in define_url_helper'
from (irb):3
from /home/guy/.rvm/gems/ruby-2.1.2/gems/railties-4.2.4/lib/rails/commands/console.rb:110:in `start'
from /home/guy/.rvm/gems/ruby-2.1.2/gems/railties-4.2.4/lib/rails/commands/console.rb:9:in `start'
from /home/guy/.rvm/gems/ruby-2.1.2/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:68:in `console'
from /home/guy/.rvm/gems/ruby-2.1.2/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /home/guy/.rvm/gems/ruby-2.1.2/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
================ edit (2) ===============
I dived into the code and saw that the line in /gems/actionpack-4.2.4/lib/action_dispatch/routing/route_set.rb (282) that raises the error is that:
t._routes.url_for(hash, route_name, url_strategy)
While the url_for function signature in url_rewriter is:
def url_for_with_subdomains(options, path_segments=nil)
Looks like I need to update something, but I don't know what.
================ edit (3) ===============
Just to be sure that it has nothing to do with my routes.rb file, I cleaned it and left it like that:
MyApp::Application.routes.draw do
root 'pages#index', :constraints => {:subdomain => /www|$^/}
end
As expected, still have the same error.
Had the same problem, the solution was instead of using:
include Rails.application.routes.url_helpers
I din't included and added url_helpers to a variable, like this:
url_helpers = Rails.application.routes.url_helpers
url_helpers.root_url
I had exactly same problem and at the end in my case
t._routes.url_for(hash, route_name, url_strategy)
called url_for_with_secure_option from bartt-ssl_requirement gem.
Since we don't need bartt-ssl_requirement gem anymore in our case solution was to simply remove bartt-ssl_requirement gem.
Try to remove subdomain-fu and use Rails4 request.subdomain when needed.
In case you get that error in the console, because you use a helper that uses URL helpers:
class << helper; include Rails.application.routes.url_helpers; end
helper.my_method # \o/
I'm am getting an error in production that doesn't occur in development. It appears in the stack trace that the gem is using the wrong version of ruby (2.1.0), but I have specified 2.1.3 in my gemfile and followed the heroku troubleshooting on ruby versions. Based on other stackoverflow information the ruby version makes a difference here. Anyone know how to update app/vendor/bundle to the latest?
This is my error which is occurring in a Resque worker...
undefined method `name' for nil:NilClass
/app/vendor/bundle/ruby/2.1.0/gems/psych-2.0.6/lib/psych/visitors/yaml_tree.rb:72:in `block in initialize'
/app/vendor/bundle/ruby/2.1.0/gems/psych-2.0.6/lib/psych/visitors/yaml_tree.rb:74:in `yield'
/app/vendor/bundle/ruby/2.1.0/gems/psych-2.0.6/lib/psych/visitors/yaml_tree.rb:74:in `block in initialize'
/app/vendor/bundle/ruby/2.1.0/gems/psych-2.0.6/lib/psych/visitors/yaml_tree.rb:74:in `yield'
/app/vendor/bundle/ruby/2.1.0/gems/psych-2.0.6/lib/psych/visitors/yaml_tree.rb:74:in `block in initialize'
/app/vendor/bundle/ruby/2.1.0/gems/psych-2.0.6/lib/psych/visitors/yaml_tree.rb:74:in `yield'
/app/vendor/bundle/ruby/2.1.0/gems/psych-2.0.6/lib/psych/visitors/yaml_tree.rb:74:in `block in initialize'
/app/vendor/bundle/ruby/2.1.0/gems/psych-2.0.6/lib/psych/visitors/yaml_tree.rb:150:in `yield'
/app/vendor/bundle/ruby/2.1.0/gems/psych-2.0.6/lib/psych/visitors/yaml_tree.rb:150:in `accept'
/app/vendor/bundle/ruby/2.1.0/gems/psych-2.0.6/lib/psych/visitors/yaml_tree.rb:114:in `push'
/app/vendor/bundle/ruby/2.1.0/gems/psych-2.0.6/lib/psych.rb:409:in `dump'
...snip...
This is my ruby version...
heroku run "ruby --version"
ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-linux]
This is what's in /app/vendor/bundle...
heroku run "ls /app/vendor/bundle/ruby"
2.1.0
This is my Gemfile ruby declaration....
source 'https://rubygems.org'
group :default do
# current stable (heroku needs this listed)
ruby '2.1.3'
gem 'rails', '4.1.1'
gem 'redis' # queue mechanism
gem 'resque', "~> 1.22.0", :require => "resque/server"
gem 'resque_mailer' # mailer queue
gem 'resque-scheduler' # job scheduler
# postgres and database
gem 'pg' # postgres
gem 'activerecord-import' # bulk sql insert
gem 'seed-fu', '~> 2.3' # db seed data
# APIs
gem 'bitly'
gem 'feedjira' # RSS feeds
gem 'fullcontact'
gem 'httparty'# rest api client
gem 'twilio-ruby' # SMS
gem 'twitter'
gem 'twitter-text' # convert twitter, links, hashtags and users
gem 'yahoo-finance', require: 'yahoo_finance'
# WEB....
# Use unicorn as the app server
gem 'unicorn'
# javascript
gem 'jquery-rails'
gem 'uglifier', '>= 1.3.0' # compressor for js assets
gem 'coffee-rails', '~> 4.0.0'
# UI/CSS
gem 'sass-rails', '~> 4.0.0'
gem 'bootstrap-sass'
gem 'jquery-ui-rails'
gem 'jqcloud-rails' # word cloud
gem 'footable-rails' # mobile responsive table
gem 'font-awesome-sass'# icons
gem 'highcharts-rails'
# rails
gem 'turbolinks'
gem 'simple_form'
# admin interface
gem 'rails_admin' # models admin interface
gem "psych", "~> 2.0.5" # needed for rails_admin
# user authentication
gem 'devise'
gem 'domp'
gem 'omniauth'
gem 'omniauth-twitter'
gem 'omniauth-stocktwits', :git => 'https://github.com/jesseyoungmann/omniauth-stocktwits.git'
# app support
gem 'bcrypt', '~> 3.1.2' # for active model secure password
gem 'kaminari', :git => 'https://github.com/musicglue/kaminari.git' # pagination
end
# docs
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
# test
group :test do
gem "capybara"
gem 'factory_girl_rails'
gem 'faker'
gem 'rspec-rails'
gem 'selenium-webdriver'
gem 'simplecov', :require => false
gem 'vcr', '~> 2.8.0'
gem 'webmock', '~> 1.15.0'
end
# development
group :development do
gem 'foreigner', '~> 1.6.1' # foreign key generator
gem 'rails_layout'
# profilers
gem 'rack-mini-profiler'
gem 'ruby-prof'
end
group :production do
gem 'newrelic_rpm'
gem 'rails_12factor' # heroku
end
Thanks!
A possible solution is to create a .ruby-version file in the root of your application and simply put 2.1.3 in it, than your app will always use that version in production and development. I had similar issues in the past and this did the trick for me.
Duplicate of this:
Why Do Heroku Stack Traces indicate Ruby 1.9.1 is in use?
Same answer as this:
Why are we installing Ruby 1.9.2/1.9.3 gems into a 1.9.1 folder?
Trying to start the server and I'm getting this:
/Users/Ross/.rvm/gems/ruby-1.9.2-p180#webapp/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require': no such file to load -- addressable/uri (LoadError)
from /Users/Ross/.rvm/gems/ruby-1.9.2-p180#webapp/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `block in require'
from /Users/Ross/.rvm/gems/ruby-1.9.2-p180#webapp/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
from /Users/Ross/.rvm/gems/ruby-1.9.2-p180#webapp/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /Users/Ross/.rvm/gems/ruby-1.9.2-p180#webapp/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
from /Users/Ross/.rvm/gems/ruby-1.9.2-p180#webapp/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
from /Users/Ross/.rvm/gems/ruby-1.9.2-p180#webapp/gems/ruby/1.9.1/gems/faraday-0.7.5/lib/faraday/connection.rb:1:in `<top (required)>'
I've tried a number of versions, deleting the Gemfile.lock, updating the bundler, etc. I've searched a lot of the threads around and it there looks to be a conflict between OmniAuth and devise but not with my error. Version conflict? How do you diagnose?
Here's my Gemfile:
source 'http://rubygems.org'
require 'rubygems'
gem 'rails'
gem 'actionpack'
gem 'jquery-rails'
gem 'haml'
gem "devise", :git => "https://github.com/plataformatec/devise.git"
# gem 'oa-core'
gem 'omniauth'
gem 'omniauth-openid'
gem 'omniauth-twitter'
gem 'omniauth-facebook'
gem 'omniauth-github'
gem "settingslogic"
gem 'composite_primary_keys'
gem 'addressable'
# gem 'faraday'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'pg'
gem 'squeel'
gem 'sqlite3'
gem 'mysql2', '~> 0.2.6'
gem "bcrypt-ruby", :require => "bcrypt"
group :development, :test do
gem 'rspec-rails'
gem 'ruby-debug19', :require => 'ruby-debug'
gem 'hpricot', :require => false #html2haml
gem 'ruby_parser', :require => false # html2haml
gem 'pickle'
gem 'awesome_print', :require => 'ap'
gem 'factory_girl_rails'
end
group :development do
gem 'heroku', :require => false
gem 'sass'
end
group :test do
gem 'shoulda'
gem 'cucumber-rails'
gem 'spork', '~> 0.9.0.rc3'
gem 'guard-spork'
gem 'database_cleaner'
end
It actually was a ownership issue the dependent gem was installed as root. I updated the ownership all the directories and files in the gems directory and it worked. If you have a problem installing (i.e. generate native code) a gem where you sudo it, remember to go back and change the ownership of files back in the gems directory back to your user account
When I run annotate at the command-line, I get the following error:
$ annotate
/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.7/lib/rails/application.rb:215:in `initialize_tasks': undefined method `task' for #<MyApp::Application:0x00000102e03b90> (NoMethodError)
from /.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.7/lib/rails/application.rb:139:in `load_tasks'
from /.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.7/lib/rails/application.rb:77:in `method_missing'
from Rakefile:8:in `<top (required)>'
from /.rvm/gems/ruby-1.9.2-p0/gems/annotate-2.4.0/lib/annotate.rb:17:in `load'
from /.rvm/gems/ruby-1.9.2-p0/gems/annotate-2.4.0/lib/annotate.rb:17:in `load_tasks'
from /.rvm/gems/ruby-1.9.2-p0/gems/annotate-2.4.0/bin/annotate:66:in `<top (required)>'
from /.rvm/gems/ruby-1.9.2-p0/bin/annotate:19:in `load'
from /.rvm/gems/ruby-1.9.2-p0/bin/annotate:19:in `<main>'
This is what my Gemfile looks like:
source 'http://rubygems.org'
gem 'rails'
gem 'sqlite3-ruby', :require => 'sqlite3'
gem 'will_paginate', '3.0.pre2'
gem 'paperclip', :git => 'git://github.com/thoughtbot/paperclip.git'
gem 'mime-types', :require => 'mime/types'
gem 'rails3-generators'
gem 'devise', '~> 1.1.3'
gem 'devise_invitable', '~> 0.3.4'
gem 'declarative_authorization', :git => 'git://github.com/stffn/declarative_authorization.git'
gem 'aasm'
gem 'braintree'
#For voting
gem 'thumbs_up'
# For In-Place-Editing
gem 'best_in_place'
#For slugs for the plans
gem "friendly_id", "~> 3.2"
gem 'aws-s3'
group :development do
# Server
gem 'thin'
gem 'annotate-models', '1.0.4'
#gem 'rails-erd'
gem 'annotate'
gem 'faker', '0.3.1'
gem 'ruby_parser'
end
This is all on my localhost btw.
Marcamillion, it probably broke because at one stage you had rake 0.9.0 installed, which broke a lot of things for a lot of people without deprecating methods or warning people. When you ran bundle update, it would have installed rake 0.9.2 which fixed this. Hope this helps someone else.
I've solved this problem using gem 'annotate', ">=2.5.0".
I'm using ruby 1.9.2p320 and Rails 3.2.13.