mirror of
https://github.com/DatabaseCleaner/database_cleaner
synced 2023-03-27 23:22:03 -04:00
fix acceptance tests to actually use default strategy, now that :truncation is no longer a safe default for all adapters.
This commit is contained in:
parent
d087c1d2a6
commit
781a4a096d
5 changed files with 15 additions and 10 deletions
|
@ -47,16 +47,22 @@ if orm && strategy
|
||||||
|
|
||||||
case orm_sym
|
case orm_sym
|
||||||
when :redis
|
when :redis
|
||||||
DatabaseCleaner[orm_sym, db: ENV['REDIS_URL_ONE']].strategy = strategy.to_sym
|
cleaner = DatabaseCleaner[orm_sym, db: ENV['REDIS_URL_ONE']]
|
||||||
DatabaseCleaner[orm_sym, db: ENV['REDIS_URL_TWO']].strategy = strategy.to_sym
|
cleaner.strategy = strategy.to_sym unless strategy == "default"
|
||||||
|
cleaner = DatabaseCleaner[orm_sym, db: ENV['REDIS_URL_TWO']]
|
||||||
|
cleaner.strategy = strategy.to_sym unless strategy == "default"
|
||||||
when :active_record
|
when :active_record
|
||||||
DatabaseCleaner[:active_record, db: ActiveRecordWidgetUsingDatabaseOne].strategy = strategy.to_sym
|
cleaner = DatabaseCleaner[:active_record, db: ActiveRecordWidgetUsingDatabaseOne]
|
||||||
DatabaseCleaner[:active_record, db: ActiveRecordWidgetUsingDatabaseTwo].strategy = strategy.to_sym
|
cleaner.strategy = strategy.to_sym unless strategy == "default"
|
||||||
|
cleaner = DatabaseCleaner[:active_record, db: ActiveRecordWidgetUsingDatabaseTwo]
|
||||||
|
cleaner.strategy = strategy.to_sym unless strategy == "default"
|
||||||
end
|
end
|
||||||
|
|
||||||
elsif another_orm
|
elsif another_orm
|
||||||
DatabaseCleaner[ orm.gsub(/(.)([A-Z]+)/,'\1_\2').downcase.to_sym].strategy = strategy.to_sym
|
cleaner = DatabaseCleaner[ orm.gsub(/(.)([A-Z]+)/,'\1_\2').downcase.to_sym]
|
||||||
DatabaseCleaner[another_orm.gsub(/(.)([A-Z]+)/,'\1_\2').downcase.to_sym].strategy = strategy.to_sym
|
cleaner.strategy = strategy.to_sym unless strategy == "default"
|
||||||
|
cleaner = DatabaseCleaner[another_orm.gsub(/(.)([A-Z]+)/,'\1_\2').downcase.to_sym]
|
||||||
|
cleaner.strategy = strategy.to_sym unless strategy == "default"
|
||||||
else
|
else
|
||||||
DatabaseCleaner.strategy = strategy.to_sym unless strategy == "default"
|
DatabaseCleaner.strategy = strategy.to_sym unless strategy == "default"
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,4 +15,4 @@ Feature: database cleaning
|
||||||
| ActiveRecord | transaction |
|
| ActiveRecord | transaction |
|
||||||
| ActiveRecord | truncation |
|
| ActiveRecord | truncation |
|
||||||
| ActiveRecord | deletion |
|
| ActiveRecord | deletion |
|
||||||
| Redis | truncation |
|
| Redis | deletion |
|
||||||
|
|
|
@ -15,5 +15,5 @@ Feature: multiple database cleaning
|
||||||
| ActiveRecord | truncation |
|
| ActiveRecord | truncation |
|
||||||
| ActiveRecord | deletion |
|
| ActiveRecord | deletion |
|
||||||
| ActiveRecord | transaction |
|
| ActiveRecord | transaction |
|
||||||
| Redis | truncation |
|
| Redis | deletion |
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ Feature: database cleaning using multiple ORMs
|
||||||
|
|
||||||
Scenario Outline: ruby app with adapter gems
|
Scenario Outline: ruby app with adapter gems
|
||||||
Given I am using <ORM1> and <ORM2> from their adapter gems
|
Given I am using <ORM1> and <ORM2> from their adapter gems
|
||||||
|
|
||||||
When I run my scenarios that rely on clean databases using multiple orms
|
When I run my scenarios that rely on clean databases using multiple orms
|
||||||
Then I should see all green
|
Then I should see all green
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ class FeatureRunner
|
||||||
attr_accessor :output
|
attr_accessor :output
|
||||||
|
|
||||||
def strategy
|
def strategy
|
||||||
@strategy || 'truncation'
|
@strategy ||= "default"
|
||||||
end
|
end
|
||||||
|
|
||||||
def go(feature)
|
def go(feature)
|
||||||
|
|
Loading…
Reference in a new issue