ruby on rails - Don't know how to build task - Cucumber -
in cucumber, seed data loaded via several rake tasks. none of working:
spree::core::engine.load_seed if defined?(spree::core) spree::auth::engine.load_seed if defined?(spree::auth) rake::task['alchemy:db:seed'].invoke
when run 1 of spree's rake tasks get:
don't know how build task 'db:load_dir' (runtimeerror)
when run 1 of alchemy's rake tasks get:
don't know how build task 'alchemy:db:seed' (runtimeerror)
the testing database exists. have ran rake db:test:prepare
, appears setup inspections. lets move onto hooks:
# features/support/hooks.rb before load file.join(rails.root, 'db', 'seeds.rb') end
this goes root , gets me seed data. decided try this:
# features/support/hooks.rb before # load file.join(rails.root, 'db', 'seeds.rb') rake::task['alchemy:db:seed'].invoke end
the error was:
don't know how build task 'alchemy:db:seed' (runtimeerror)
i'm unable figure out why rake tasks not working in cucumber.
my gemfile follows:
source 'https://rubygems.org' ruby '2.1.2' gem 'rails', '4.0.6' gem 'pg' gem 'redis-rails' gem 'redis-rack-cache' gem 'sass-rails', '~> 4.0.3' gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.0.0' gem 'jquery-rails' gem 'turbolinks' gem 'jbuilder', '~> 2.0' gem 'thin' gem 'durable_decorator_rails', github: 'jumph4x/durable_decorator_rails' gem 'newrelic_rpm' gem 'rake' gem 'spree', '2.2.2' gem 'spree_gateway', github: 'spree/spree_gateway', branch: '2-2-stable' gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '2-2-stable' gem 'spree_bootstrap_frontend', github: '200creative/spree_bootstrap_frontend', branch: '2-2-stable' gem 'alchemy_cms', github: 'magiclabs/alchemy_cms' gem 'spree_alchemy', github: 'tesserakt/spree_alchemy' group :doc gem 'sdoc', '~> 0.4.0' end group :development gem 'better_errors' gem 'binding_of_caller' gem 'meta_request' end group :test gem 'simplecov', require: false gem 'cucumber-rails', require: false gem "cucumber-websteps" gem 'database_cleaner' gem "selenium-webdriver" gem "capybara-webkit" end group :development, :test gem "factory_girl_rails", "~> 4.0" gem "rspec-rails" gem 'rspec-its' gem 'shoulda-matchers', require: false end
and env support file:
# features/support/env.rb require 'cucumber/rails' actioncontroller::base.allow_rescue = false begin databasecleaner.strategy = :transaction rescue nameerror raise 'you need add database_cleaner your' \ 'gemfile (in :test group) if wish use it.' end cucumber::rails::database.javascript_strategy = :truncation capybara.register_driver :chrome |app| capybara::selenium::driver.new(app, browser: :chrome) end capybara.javascript_driver = :chrome
it seems test database missing. written in comment above, solution create database , run migrations with
rails_env=test rake db:setup
happy :)
Comments
Post a Comment