ActiveRecord::AdapterNotSpecified error when running rspec with rails 4.1 - rails-activerecord

I have not been able to find this exact error anywhere else on Google or on stackoverflow.
I am running Rails 4.1.0 and rspec-rails 3.0.0.beta2
When trying to run $rspec, I get the following error:
DEPRECATION WARNING: Passing a string to ActiveRecord::Base.establish_connection for a configuration lookup is deprecated, please pass a symbol (:development) instead. (called from <top (required)> at /Users/sam/code/rails/innovacert/spec/spec_helper.rb:4)
/Users/sam/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/connection_specification.rb:257:in `resolve_symbol_connection': 'development' database is not configured. Available: ["test"] (ActiveRecord::AdapterNotSpecified)
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/connection_specification.rb:240:in `resolve_string_connection'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/connection_specification.rb:267:in `resolve_hash_connection'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/connection_specification.rb:228:in `resolve_connection'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/connection_specification.rb:152:in `resolve'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/connection_specification.rb:164:in `block in resolve_all'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/connection_specification.rb:163:in `each'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/connection_specification.rb:163:in `resolve_all'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_handling.rb:69:in `resolve'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/core.rb:46:in `configurations='
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/core.rb:48:in `block in <module:Core>'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/concern.rb:120:in `class_eval'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/concern.rb:120:in `append_features'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/base.rb:297:in `include'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/base.rb:297:in `<class:Base>'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/base.rb:282:in `<module:ActiveRecord>'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/base.rb:23:in `<top (required)>'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/rspec-rails-3.0.0.beta2/lib/rspec/rails/extensions/active_record/base.rb:25:in `<module:Extensions>'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/rspec-rails-3.0.0.beta2/lib/rspec/rails/extensions/active_record/base.rb:4:in `<module:Rails>'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/rspec-rails-3.0.0.beta2/lib/rspec/rails/extensions/active_record/base.rb:2:in `<module:RSpec>'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/rspec-rails-3.0.0.beta2/lib/rspec/rails/extensions/active_record/base.rb:1:in `<top (required)>'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `require'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `block in require'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `require'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/rspec-rails-3.0.0.beta2/lib/rspec/rails/extensions.rb:1:in `<top (required)>'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `require'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `block in require'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `require'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/rspec-rails-3.0.0.beta2/lib/rspec/rails.rb:10:in `<top (required)>'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `require'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `block in require'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `require'
from /Users/sam/code/rails/innovacert/spec/spec_helper.rb:4:in `<top (required)>'
from /Users/sam/code/rails/innovacert/spec/validators/rut_validator_spec.rb:1:in `require'
from /Users/sam/code/rails/innovacert/spec/validators/rut_validator_spec.rb:1:in `<top (required)>'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.0.beta2/lib/rspec/core/configuration.rb:932:in `load'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.0.beta2/lib/rspec/core/configuration.rb:932:in `block in load_spec_files'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.0.beta2/lib/rspec/core/configuration.rb:932:in `each'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.0.beta2/lib/rspec/core/configuration.rb:932:in `load_spec_files'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.0.beta2/lib/rspec/core/command_line.rb:21:in `run'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.0.beta2/lib/rspec/core/runner.rb:100:in `run'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.0.beta2/lib/rspec/core/runner.rb:31:in `invoke'
from /Users/sam/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.0.beta2/exe/rspec:4:in `<top (required)>'
from /Users/sam/.rvm/gems/ruby-2.1.1/bin/rspec:23:in `load'
from /Users/sam/.rvm/gems/ruby-2.1.1/bin/rspec:23:in `<main>'
from /Users/sam/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
from /Users/sam/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'
The error is being generated from a "require 'rspec/rails'" in spec_helper.rb.
I don't understand why this is happening as I have my test database configured properly in database.yml:
default: &default
host: localhost
adapter: postgresql
encoding: unicode
pool: 5
timeout: 5000
development:
<<: *default
database: innovacert_development
username: <%= ENV['DATABASE_USER'] %>
password: <%= ENV['DATABASE_PASS'] %>
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: innovacert_test
username: sam
password:
From this line:
/Users/sam/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/connection_specification.rb:257:in `resolve_symbol_connection': 'development' database is not configured. Available: ["test"] (ActiveRecord::AdapterNotSpecified)
IT would appear that rspec is trying to look for a database called :development. Yet in spec_helper.rb I explicitly define:
ENV["RAILS_ENV"] ||= "test"
I have used pry to take a look at this variable and it is definitely being assigned as 'test'.
Why is rspec failing?

Related

need basic setup to test a website on real android device (chrome browser) using ruby appium framework

I am trying to setup a basic framework with Cucumber, Appium and Ruby. I am getting errors when I run the basic script. I am testing web app on chrome browser for Android device. I can't figure out what's wrong with the setup. Appium Desktop for windows is running in the background
(Appium v1.12.1)
My env.rb
require "appium_lib"
def caps
{caps:
{
deviceName: "Android_Device",
platformName: "Android",
browserName: "Chrome",
newCommandTimeout: "3600"
}
}
end
Appium::Driver.new(caps, true)
Appium.promote_appium_methods Object
My hooks.rb file
Before do
$driver.start_driver
end
After do
sleep 3
$driver.driver.quit
end
My Step Definition file
Given(/^I log on to the site with the following:$/) do |table|
p "it works"
end
My feature file
Given I log on to the site with the following:
|site|
|ABC|
I am expecting the feature/scenario to pass
Actual Result-
C:\Users\Documents\xyz\abc (master)
λ cucumber features\Simple_POC.feature --tags #run
Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
cannot load such file -- 2.5/rubyeventmachine (LoadError)
C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/eventmachine-1.2.7-x64-mingw32/lib/rubyeventmachine.rb:2:in `<top (required)>'
C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `require'
C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:in `require'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/eventmachine-1.2.7-x64-mingw32/lib/eventmachine.rb:8:in `<top (required)>'
C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `require'
C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:in `require'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/faye-websocket-0.10.7/lib/faye/websocket.rb:10:in `<top (required)>'
C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/appium_lib_core-3.0.4/lib/appium_lib_core/common/ws/websocket.rb:15:in `<top (required)>'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/appium_lib_core-3.0.4/lib/appium_lib_core/common.rb:21:in `require_relative'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/appium_lib_core-3.0.4/lib/appium_lib_core/common.rb:21:in `<top (required)>'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/appium_lib_core-3.0.4/lib/appium_lib_core.rb:18:in `require_relative'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/appium_lib_core-3.0.4/lib/appium_lib_core.rb:18:in `<top (required)>'
C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/appium_lib-10.2.0/lib/appium_lib/appium.rb:5:in `<top (required)>'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/appium_lib-10.2.0/lib/appium_lib.rb:10:in `require_relative'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/appium_lib-10.2.0/lib/appium_lib.rb:10:in `<top (required)>'
C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `require'
C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:in `require'
C:/Users/Documents/xyz/abc/features/support/env.rb:1:in `<top (required)>'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/glue/registry_and_more.rb:107:in `load'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/glue/registry_and_more.rb:107:in `load_code_file'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/runtime/support_code.rb:144:in `load_file'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/runtime/support_code.rb:85:in `block in load_files!'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/runtime/support_code.rb:84:in `each'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/runtime/support_code.rb:84:in `load_files!'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/runtime.rb:272:in `load_step_definitions'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/runtime.rb:68:in `run!'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/lib/cucumber/cli/main.rb:34:in `execute!'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/cucumber-3.1.2/bin/cucumber:9:in `<top (required)>'
C:/Ruby25-x64/bin/cucumber:23:in `load'
C:/Ruby25-x64/bin/cucumber:23:in `<main>'
was able to resolve the issue by doing the following -
1) gem uninstall eventmachine
2) gem install eventmachine --platform ruby
Tried few other solutions but the only one which worked are the above 2 steps.
Might help someone in the future

Ruby Rake - Error

I am using vmware and trying to run rake db:migrate for getting the database tables. I am getting this error.
ubuntu#ubuntu-VirtualBox:~/hw-acceptance-unit-test-cycle/rottenpotatoes$ bundle exec rake db:migrate
rake aborted!
Bundler::GemRequireError: There was an error while trying to load the gem 'coffee-rails'.
Gem Load Error is: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
Backtrace for gem load error is:
/var/lib/gems/2.3.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in ` autodetect'
/var/lib/gems/2.3.0/gems/execjs-2.7.0/lib/execjs.rb:5:in `<module:ExecJS>'
/var/lib/gems/2.3.0/gems/execjs-2.7.0/lib/execjs.rb:4:in `<top (required)>'
/var/lib/gems/2.3.0/gems/coffee-script-2.4.1/lib/coffee_script.rb:1:in `require'
/var/lib/gems/2.3.0/gems/coffee-script-2.4.1/lib/coffee_script.rb:1:in `<top (required)>'
/var/lib/gems/2.3.0/gems/coffee-script-2.4.1/lib/coffee-script.rb:1:in `require'
/var/lib/gems/2.3.0/gems/coffee-script-2.4.1/lib/coffee-script.rb:1:in `<top (required)>'
/var/lib/gems/2.3.0/gems/coffee-rails-4.1.1/lib/coffee-rails.rb:1:in `require'
/var/lib/gems/2.3.0/gems/coffee-rails-4.1.1/lib/coffee-rails.rb:1:in `<top (required)>'
/var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:91:in `require'
/var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:91:in `block (2 levels) in require'
/var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `each'
/var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `block in require'
/var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `each'
/var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `require'
/var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler.rb:106:in `require'
/home/ubuntu/hw-acceptance-unit-test-cycle/rottenpotatoes/config/application.rb:12:in `<top (required)>'
/home/ubuntu/hw-acceptance-unit-test-cycle/rottenpotatoes/Rakefile:5:in `require'
/home/ubuntu/hw-acceptance-unit-test-cycle/rottenpotatoes/Rakefile:5:in `<top (required)>'
/var/lib/gems/2.3.0/gems/rake-11.2.2/lib/rake/rake_module.rb:28:in `load'
/var/lib/gems/2.3.0/gems/rake-11.2.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/var/lib/gems/2.3.0/gems/rake-11.2.2/lib/rake/application.rb:686:in `raw_load_rakefile'
/var/lib/gems/2.3.0/gems/rake-11.2.2/lib/rake/application.rb:96:in `block in load_rakefile'
/var/lib/gems/2.3.0/gems/rake-11.2.2/lib/rake/application.rb:178:in `standard_exception_handling'
/var/lib/gems/2.3.0/gems/rake-11.2.2/lib/rake/application.rb:95:in `load_rakefile'
/var/lib/gems/2.3.0/gems/rake-11.2.2/lib/rake/application.rb:79:in `block in run'
/var/lib/gems/2.3.0/gems/rake-11.2.2/lib/rake/application.rb:178:in `standard_exception_handling'
/var/lib/gems/2.3.0/gems/rake-11.2.2/lib/rake/application.rb:77:in `run'
/var/lib/gems/2.3.0/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `<main>'
Bundler Error Backtrace:
/var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:94:in `rescue in block (2 levels) in require'
/var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:90:in `block (2 levels) in require'
/var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `each'
/var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `block in require'
/var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `each'
/var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `require'
/var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler.rb:106:in `require'
/home/ubuntu/hw-acceptance-unit-test-cycle/rottenpotatoes/config/application.rb:12:in `<top (required)>'
/home/ubuntu/hw-acceptance-unit-test-cycle/rottenpotatoes/Rakefile:5:in `require'
/home/ubuntu/hw-acceptance-unit-test-cycle/rottenpotatoes/Rakefile:5:in `<top (required)>'
/var/lib/gems/2.3.0/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'
ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
/var/lib/gems/2.3.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in `autodetect'
/var/lib/gems/2.3.0/gems/execjs-2.7.0/lib/execjs.rb:5:in `<module:ExecJS>'
/var/lib/gems/2.3.0/gems/execjs-2.7.0/lib/execjs.rb:4:in `<top (required)>'
/var/lib/gems/2.3.0/gems/coffee-script-2.4.1/lib/coffee_script.rb:1:in `require'
/var/lib/gems/2.3.0/gems/coffee-script-2.4.1/lib/coffee_script.rb:1:in `<top (required)>'
/var/lib/gems/2.3.0/gems/coffee-script-2.4.1/lib/coffee-script.rb:1:in `require'
/var/lib/gems/2.3.0/gems/coffee-script-2.4.1/lib/coffee-script.rb:1:in `<top (required)>'
/var/lib/gems/2.3.0/gems/coffee-rails-4.1.1/lib/coffee-rails.rb:1:in `require'
/var/lib/gems/2.3.0/gems/coffee-rails-4.1.1/lib/coffee-rails.rb:1:in `<top (required)>'
/var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:91:in `require'
/var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:91:in `block (2 levels) in require'
/var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `each'
/var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in block in require'
/var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:ineach'
/var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in require'
/var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler.rb:106:inrequire'
/home/ubuntu/hw-acceptance-unit-test-cycle/rottenpotatoes/config/application.rb:12:in <top (required)>'
/home/ubuntu/hw-acceptance-unit-test-cycle/rottenpotatoes/Rakefile:5:inrequire'
/home/ubuntu/hw-acceptance-unit-test-cycle/rottenpotatoes/Rakefile:5:in <top (required)>'
/var/lib/gems/2.3.0/gems/rake-11.2.2/exe/rake:27:in'
(See full trace by running task with --trace)
What is the problem?
If you are on Linux then run:
sudo apt-get install nodejs
On Mac:
brew install node
and then run bundle and try to migrate. Must work.
Also you shall be more attentive to the search on Stackoverflow for not to duplicate same topics.
Rails - Could not find a JavaScript runtime?

Something wrong with active_record

I got this error when i ran the 'rackup' command after using rake for database migrations, i don't understand what this means.
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.2.3/lib/active_record/railties/databases.rake:3:in `<top (required)>': undefined method `namespace' for main:Object (NoMethodError)
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `load'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `block in load'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `load'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sinatra-activerecord-2.0.6/lib/sinatra/activerecord/rake.rb:1:in `<top (required)>'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `block in require'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
from C:/wamp/www/sinatra-template-master/config.ru:2:in `block in <main>'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
from C:/wamp/www/sinatra-template-master/config.ru:in `new'
from C:/wamp/www/sinatra-template-master/config.ru:in `<main>'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/server.rb:272:in `start'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/server.rb:147:in `start'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/bin/rackup:4:in `<top (required)>'
from C:/RailsInstaller/Ruby2.1.0/bin/rackup:23:in `load'
from C:/RailsInstaller/Ruby2.1.0/bin/rackup:23:in `<main>'
pls help, thanks!
i have this in my config.ru file
require './app'
require 'sinatra/activerecord/rake'
run Sinatra::Application
I tried to do the same config.ru. When i removed
require 'sinatra/activerecord/rake'
Everything started to work.
Method "namespace" is defined in rake/dsl_definition.rb. So, your application extending Sinatra::Base doesn't see it.

Rspec, Capybara, Guard - uninitialized constant ActiveRecord::Base (NameError)

When I start guard and save a rspec request, I always get this error,
I referred to this tutorial, http://railscasts.com/episodes/275-how-i-test
uninitialized constant ActiveRecord::Base (NameError)
See below,
/home/think/.rvm/gems/ruby-1.9.3-p385/gems/audited-activerecord-3.0.0/lib/audited/adapters/active_record/audit.rb:16:in `<module:ActiveRecord>': uninitialized constant ActiveRecord::Base (NameError)
from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/audited-activerecord-3.0.0/lib/audited/adapters/active_record/audit.rb:6:in `<module:Adapters>'
from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/audited-activerecord-3.0.0/lib/audited/adapters/active_record/audit.rb:5:in `<module:Audited>'
from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/audited-activerecord-3.0.0/lib/audited/adapters/active_record/audit.rb:4:in `<top (required)>'
from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/audited-activerecord-3.0.0/lib/audited/adapters/active_record.rb:3:in `<top (required)>'
from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/audited-activerecord-3.0.0/lib/audited-activerecord.rb:2:in `<top (required)>'
from /home/think/.rvm/gems/ruby-1.9.3-p385#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `require'
from /home/think/.rvm/gems/ruby-1.9.3-p385#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /home/think/.rvm/gems/ruby-1.9.3-p385#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `each'
from /home/think/.rvm/gems/ruby-1.9.3-p385#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `block in require'
from /home/think/.rvm/gems/ruby-1.9.3-p385#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `each'
from /home/think/.rvm/gems/ruby-1.9.3-p385#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `require'
from /home/think/.rvm/gems/ruby-1.9.3-p385#global/gems/bundler-1.2.3/lib/bundler.rb:128:in `require'
from /home/think/jonathan/organizor/config/application.rb:7:in `<top (required)>'
from /home/think/jonathan/organizor/config/environment.rb:2:in `require'
from /home/think/jonathan/organizor/config/environment.rb:2:in `<top (required)>'
from /home/think/jonathan/organizor/spec/spec_helper.rb:3:in `require'
from /home/think/jonathan/organizor/spec/spec_helper.rb:3:in `<top (required)>'
from /home/think/jonathan/organizor/spec/requests/password_resets_spec.rb:1:in `require'
from /home/think/jonathan/organizor/spec/requests/password_resets_spec.rb:1:in `<top (required)>'
from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `load'
from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `block in load_spec_files'
from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `each'
from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `load_spec_files'
from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/command_line.rb:22:in `run'
from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/runner.rb:80:in `run'
from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/runner.rb:17:in `block in autorun'
I havent done rails testing. This is my first time. I certainly know that some config I have missed. Please help.
This is amazing, I had a empty file in lib directory called, "active_record.rb", this was being loaded instead of rails ActiveRecord. Hence, the uninitialized name error. Guys, be careful what you name your classes that you are going to keep under lib. It overrides.
Gosh, ate one day to figure this out.

MongoMapper: undefined method `each' for "StandardFormBuilder":String

I'm using MongoMapper with Padrino, and I'm having trouble with executing any padrino tasks. I get this error for nearly every tasks.
ethan#tardis:/var/www/sakura$ padrino rake -T
=> Executing Rake -T ...
/home/ethan/.rvm/gems/ruby-1.9.2-head/gems/mongo_mapper-0.8.6/lib/mongo_mapper/plugins/modifiers.rb:19:in `set': undefined method `each' for "StandardFormBuilder":String (NoMethodError)
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/padrino-helpers-0.9.29/lib/padrino-helpers.rb:33:in `registered'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/sinatra-1.2.6/lib/sinatra/base.rb:1200:in `block in register'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/sinatra-1.2.6/lib/sinatra/base.rb:1198:in `each'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/sinatra-1.2.6/lib/sinatra/base.rb:1198:in `register'
from /var/www/sakura/app/app.rb:3:in `<class:Sakura>'
from /var/www/sakura/app/app.rb:1:in `<top (required)>'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/padrino-core-0.9.29/lib/padrino-core/reloader.rb:128:in `require'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/padrino-core-0.9.29/lib/padrino-core/reloader.rb:128:in `safe_load'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/padrino-core-0.9.29/lib/padrino-core/loader.rb:140:in `block in require_dependencies'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/padrino-core-0.9.29/lib/padrino-core/loader.rb:138:in `each'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/padrino-core-0.9.29/lib/padrino-core/loader.rb:138:in `require_dependencies'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/padrino-core-0.9.29/lib/padrino-core/mounter.rb:125:in `locate_app_object'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/padrino-core-0.9.29/lib/padrino-core/mounter.rb:21:in `initialize'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/padrino-core-0.9.29/lib/padrino-core/mounter.rb:189:in `new'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/padrino-core-0.9.29/lib/padrino-core/mounter.rb:189:in `mount'
from /var/www/sakura/config/apps.rb:34:in `<top (required)>'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/padrino-core-0.9.29/lib/padrino-core/reloader.rb:128:in `require'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/padrino-core-0.9.29/lib/padrino-core/reloader.rb:128:in `safe_load'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/padrino-core-0.9.29/lib/padrino-core/loader.rb:140:in `block in require_dependencies'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/padrino-core-0.9.29/lib/padrino-core/loader.rb:138:in `each'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/padrino-core-0.9.29/lib/padrino-core/loader.rb:138:in `require_dependencies'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/padrino-core-0.9.29/lib/padrino-core/loader.rb:56:in `block in load!'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/padrino-core-0.9.29/lib/padrino-core/loader.rb:56:in `each'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/padrino-core-0.9.29/lib/padrino-core/loader.rb:56:in `load!'
from /var/www/sakura/config/boot.rb:29:in `<top (required)>'
from /home/ethan/.rvm/rubies/ruby-1.9.2-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /home/ethan/.rvm/rubies/ruby-1.9.2-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/padrino-core-0.9.29/lib/padrino-core/cli/base.rb:51:in `block in rake'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/padrino-core-0.9.29/lib/padrino-core/cli/base.rb:130:in `capture'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/padrino-core-0.9.29/lib/padrino-core/cli/base.rb:51:in `rake'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/gems/padrino-core-0.9.29/bin/padrino:8:in `<top (required)>'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/bin/padrino:19:in `load'
from /home/ethan/.rvm/gems/ruby-1.9.2-head/bin/padrino:19:in `<main>'
I tried this with multiple Ruby versions, with similar results. Is this an error with Sinatra, MongoMapper, or what?
Seems a problem with ActiveSupport.
In your gemfile add:
gem "mongo_mapper", "~> 0.9.1"

Resources