开发者

cucumber: uses dev db even if I specify RAILS_ENV=test at commandline

开发者 https://www.devze.com 2023-04-01 21:11 出处:网络
relevant part of database.yml: development: adapter: mysql encoding: utf8 database: dev username: root password:

relevant part of database.yml:

development:
  adapter: mysql
  encoding: utf8
  database: dev
  username: root
  password:

test: &TEST
  adapter: mysql
  encoding: utf8
  database: test
  username: root
  password:


cucumber:
<<: *TEST

culerity:
<<: *TEST

So, it seems that whenever cucumber interacts with the browser, it modifies the development database. But when I do things programmatically (such as adding a default user to login), it modifies the test database.

Why would the test env me responding to ruby/rails requests, but switches over to dev when the view-tests are running?

This is how I'm running cucumber:

$> bundle exec rake test:cucumber:authenticatio开发者_如何学运维n

which runs the task in this file:

begin

  require 'rubygems'

  ENV["RAILS_ENV"]="test"
  require 'cucumber'
  require 'cucumber/rake/task'

  namespace :test do
    namespace :cucumber do

      Cucumber::Rake::Task.new(:authentication) do |t|
        t.cucumber_opts = "features/Authentication.feature"
      end
...
0

精彩评论

暂无评论...
验证码 换一张
取 消