run inner cucumber tests in base working dir so that results merge properly.

This commit is contained in:
Micah Geisel 2020-04-26 17:58:22 -07:00
parent 2840cb6c62
commit fb036b6a9c
3 changed files with 30 additions and 52 deletions

View file

@ -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| Given /^I am using #{orms_pattern} from its adapter gem$/ do |orm|
@feature_runner = FeatureRunner.new @feature_runner = FeatureRunner.new

View file

@ -1,18 +1,35 @@
require 'rspec/expectations' require 'rspec/expectations'
if ENV['COVERAGE'] == 'true' class FeatureRunner
require "simplecov" 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' def strategy
require 'codecov' @strategy || 'truncation'
SimpleCov.formatter = SimpleCov::Formatter::Codecov
puts "required codecov"
end end
SimpleCov.start def go(feature)
puts "required simplecov" 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 end
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
require 'database_cleaner-core'

View file

@ -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