2010-05-16 16:44:09 -04:00
|
|
|
class FeatureRunner
|
2018-05-18 22:16:03 -04:00
|
|
|
attr_accessor :use_gems
|
2010-05-16 16:44:09 -04:00
|
|
|
attr_accessor :orm
|
|
|
|
attr_accessor :another_orm
|
2010-05-25 13:21:45 -04:00
|
|
|
attr_accessor :multiple_databases
|
2010-05-16 16:44:09 -04:00
|
|
|
attr_accessor :strategy
|
|
|
|
attr_accessor :exit_status
|
|
|
|
attr_accessor :output
|
2010-05-30 23:12:58 -04:00
|
|
|
|
2010-05-16 16:44:09 -04:00
|
|
|
def strategy
|
|
|
|
@strategy || 'truncation'
|
|
|
|
end
|
2010-05-30 23:12:58 -04:00
|
|
|
|
2010-05-31 00:37:23 -04:00
|
|
|
def go(feature)
|
2010-05-16 16:44:09 -04:00
|
|
|
full_dir ||= File.expand_path(File.dirname(__FILE__) + "/../../examples/")
|
|
|
|
Dir.chdir(full_dir) do
|
2010-08-23 16:50:32 -04:00
|
|
|
|
|
|
|
|
2018-05-18 22:16:03 -04:00
|
|
|
ENV['USE_GEMS'] = use_gems ? "true" : nil
|
2010-05-31 00:57:18 -04:00
|
|
|
ENV['ORM'] = orm
|
2010-05-25 13:21:45 -04:00
|
|
|
ENV['STRATEGY'] = strategy
|
2010-08-23 16:50:32 -04:00
|
|
|
|
2010-06-15 10:24:50 -04:00
|
|
|
if another_orm
|
|
|
|
ENV['ANOTHER_ORM'] = another_orm
|
|
|
|
else
|
|
|
|
ENV['ANOTHER_ORM'] = nil
|
|
|
|
end
|
2010-08-23 16:50:32 -04:00
|
|
|
|
2010-06-15 10:24:50 -04:00
|
|
|
if multiple_databases
|
|
|
|
ENV['MULTIPLE_DBS'] = "true"
|
|
|
|
else
|
2010-08-23 16:50:32 -04:00
|
|
|
ENV['MULTIPLE_DBS'] = nil
|
2010-06-15 10:24:50 -04:00
|
|
|
end
|
2010-05-16 16:44:09 -04:00
|
|
|
|
|
|
|
self.output = `#{"jruby -S " if defined?(JRUBY_VERSION)}cucumber features/#{feature}.feature`
|
|
|
|
|
2010-05-30 23:12:58 -04:00
|
|
|
self.exit_status = $?.exitstatus
|
|
|
|
end
|
2010-05-16 16:44:09 -04:00
|
|
|
end
|
2010-05-30 23:12:58 -04:00
|
|
|
|
|
|
|
end
|