mirror of
https://github.com/DatabaseCleaner/database_cleaner
synced 2023-03-27 23:22:03 -04:00
run inner cucumber tests in base working dir so that results merge properly.
This commit is contained in:
parent
2840cb6c62
commit
fb036b6a9c
3 changed files with 30 additions and 52 deletions
|
@ -1,4 +1,4 @@
|
|||
orms_pattern = /(ActiveRecord|DataMapper|Sequel|MongoMapper|Mongoid|CouchPotato|Redis|Ohm|Neo4j)/
|
||||
orms_pattern = /(ActiveRecord|Redis)/
|
||||
|
||||
Given /^I am using #{orms_pattern} from its adapter gem$/ do |orm|
|
||||
@feature_runner = FeatureRunner.new
|
||||
|
|
|
@ -1,18 +1,35 @@
|
|||
require 'rspec/expectations'
|
||||
|
||||
if ENV['COVERAGE'] == 'true'
|
||||
require "simplecov"
|
||||
class FeatureRunner
|
||||
attr_accessor :orm
|
||||
attr_accessor :another_orm
|
||||
attr_accessor :multiple_databases
|
||||
attr_accessor :strategy
|
||||
attr_accessor :exit_status
|
||||
attr_accessor :output
|
||||
|
||||
if ENV['CI'] == 'true'
|
||||
require 'codecov'
|
||||
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
||||
puts "required codecov"
|
||||
def strategy
|
||||
@strategy || 'truncation'
|
||||
end
|
||||
|
||||
SimpleCov.start
|
||||
puts "required simplecov"
|
||||
def go(feature)
|
||||
ENV['ORM'] = orm
|
||||
ENV['STRATEGY'] = strategy
|
||||
|
||||
if another_orm
|
||||
ENV['ANOTHER_ORM'] = another_orm
|
||||
else
|
||||
ENV['ANOTHER_ORM'] = nil
|
||||
end
|
||||
|
||||
if multiple_databases
|
||||
ENV['MULTIPLE_DBS'] = "true"
|
||||
else
|
||||
ENV['MULTIPLE_DBS'] = nil
|
||||
end
|
||||
|
||||
self.output = `cucumber --strict examples/features/#{feature}.feature --require examples/features/support --require examples/features/step_definitions`
|
||||
|
||||
self.exit_status = $?.exitstatus
|
||||
end
|
||||
end
|
||||
|
||||
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
|
||||
require 'database_cleaner-core'
|
||||
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
class FeatureRunner
|
||||
attr_accessor :orm
|
||||
attr_accessor :another_orm
|
||||
attr_accessor :multiple_databases
|
||||
attr_accessor :strategy
|
||||
attr_accessor :exit_status
|
||||
attr_accessor :output
|
||||
|
||||
def strategy
|
||||
@strategy || 'truncation'
|
||||
end
|
||||
|
||||
def go(feature)
|
||||
full_dir ||= File.expand_path(File.dirname(__FILE__) + "/../../examples/")
|
||||
Dir.chdir(full_dir) do
|
||||
|
||||
|
||||
ENV['ORM'] = orm
|
||||
ENV['STRATEGY'] = strategy
|
||||
|
||||
if another_orm
|
||||
ENV['ANOTHER_ORM'] = another_orm
|
||||
else
|
||||
ENV['ANOTHER_ORM'] = nil
|
||||
end
|
||||
|
||||
if multiple_databases
|
||||
ENV['MULTIPLE_DBS'] = "true"
|
||||
else
|
||||
ENV['MULTIPLE_DBS'] = nil
|
||||
end
|
||||
|
||||
self.output = `cucumber features/#{feature}.feature`
|
||||
|
||||
self.exit_status = $?.exitstatus
|
||||
end
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in a new issue