File: feature_runner.rb

package info (click to toggle)
ruby-database-cleaner 1.7.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 768 kB
  • sloc: ruby: 4,854; makefile: 10; sh: 4
file content (39 lines) | stat: -rw-r--r-- 831 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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 = `#{"jruby -S " if defined?(JRUBY_VERSION)}cucumber features/#{feature}.feature`

      self.exit_status = $?.exitstatus
    end
  end

end