I am writing BDD using cucumber for my Rails app but getting problems while running 'cucumber'
My database for test is "test_db". When I run cucumber features/my_Feature_file.feature, it show scenarios pass or fail but along with, It is also cleaning my database.
I am newbie to cucumber. So please tell me that it is default for testing that when you run cucumber, then database will be cleaned. Like If I am writing BDD for user login, So if there will be no any record then how my steps will check that User is valid or not?
I am using:
Gemfile (for test)-
group :test do
gem 'ZenTest'
gem 'autotest-rails'
gem 'autotest-growl'
gem 'selenium'
gem 'selenium-client'
gem 'capybara'
gem 'database_cleaner'
gem 'cucumber-rails'
gem 'cucumber'
gem 'rspec-rails'
gem 'spork'
gem 'xpath'
gem 'launchy'
gem 'cucumber-sinatra'
gem 'webrat'
end
features/support/env.rb-
require 'cucumber/rails'
Capybara.default_selector = :css
ActionController::Base.allow_rescue = false
begin
DatabaseCleaner.strategy = :transaction
#DatabaseCleaner.strategy = nil
rescue NameError
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end
Cucumber::Rails::Database.javascript_strategy = :truncation
I tried using:
DatabaseCleaner.strategy = nil
and
Cucumber::Rails::World.use_transactional_fixtures = false
Can someone clear my confusions and guide me to the right way? Help is highly appreciated.