Sha256: 43d1a45b4d2a7c183a58f509f78630689248214b0a9a880dd4379c3c5ac591d1

Contents?: true

Size: 819 Bytes

Versions: 27

Compression:

Stored size: 819 Bytes

Contents

begin
  require 'database_cleaner'
  require 'database_cleaner/cucumber'

  DatabaseCleaner.strategy = :truncation
rescue NameError
  raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end

if ::ActiveRecord::VERSION::MAJOR < 4
  fixture_class = ActiveRecord::Fixtures
else
  fixture_class = ActiveRecord::FixtureSet
end

fixtures_folder = File.join(Rails.root, 'test', 'fixtures')
fixtures = Dir[File.join(fixtures_folder, '*.yml')].map {|f| File.basename(f, '.yml') }
if defined? RailsCsvFixtures
  fixtures += Dir[File.join(fixtures_folder, '*.csv')].map {|f| File.basename(f, '.csv') }
end

Before do
  DatabaseCleaner.start
  fixture_class.create_fixtures(fixtures_folder, fixtures)
end

After do |scenario|
  fixture_class.reset_cache
  DatabaseCleaner.clean
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
daddy-0.5.9 lib/daddy/cucumber/hooks/database.rb
daddy-0.5.8 lib/daddy/cucumber/hooks/database.rb
daddy-0.5.7 lib/daddy/cucumber/hooks/database.rb
daddy-0.5.6 lib/daddy/cucumber/hooks/database.rb
daddy-0.5.5 lib/daddy/cucumber/hooks/database.rb
daddy-0.5.4 lib/daddy/cucumber/hooks/database.rb
daddy-0.5.3 lib/daddy/cucumber/hooks/database.rb
daddy-0.5.2 lib/daddy/cucumber/hooks/database.rb
daddy-0.5.1 lib/daddy/cucumber/hooks/database.rb
daddy-0.5.0 lib/daddy/cucumber/hooks/database.rb
daddy-0.4.10 lib/daddy/cucumber/hooks/database.rb
daddy-0.4.9 lib/daddy/cucumber/hooks/database.rb
daddy-0.4.8 lib/daddy/cucumber/hooks/database.rb
daddy-0.4.7 lib/daddy/cucumber/hooks/database.rb
daddy-0.4.6 lib/daddy/cucumber/hooks/database.rb
daddy-0.4.5 lib/daddy/cucumber/hooks/database.rb
daddy-0.4.4 lib/daddy/cucumber/hooks/database.rb
daddy-0.4.3 lib/daddy/cucumber/hooks/database.rb
daddy-0.4.2 lib/daddy/cucumber/hooks/database.rb
daddy-0.4.1 lib/daddy/cucumber/hooks/database.rb