Class: Flatware::Cucumber::Runtime

Inherits:
Cucumber::Runtime
  • Object
show all
Defined in:
lib/flatware/cucumber/runtime.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(out = StringIO.new, err = out) ⇒ Runtime



11
12
13
14
15
16
# File 'lib/flatware/cucumber/runtime.rb', line 11

def initialize(out=StringIO.new, err=out)
  @out, @err = out, err
  super(default_configuration)
  load_step_definitions
  @results = Results.new(configuration)
end

Instance Attribute Details

#configurationObject

Returns the value of attribute configuration.



7
8
9
# File 'lib/flatware/cucumber/runtime.rb', line 7

def configuration
  @configuration
end

#errObject (readonly)

Returns the value of attribute err.



8
9
10
# File 'lib/flatware/cucumber/runtime.rb', line 8

def err
  @err
end

#loaderObject

Returns the value of attribute loader.



7
8
9
# File 'lib/flatware/cucumber/runtime.rb', line 7

def loader
  @loader
end

#outObject (readonly)

Returns the value of attribute out.



8
9
10
# File 'lib/flatware/cucumber/runtime.rb', line 8

def out
  @out
end

#visitorObject (readonly)

Returns the value of attribute visitor.



9
10
11
# File 'lib/flatware/cucumber/runtime.rb', line 9

def visitor
  @visitor
end

Instance Method Details

#default_configurationObject



18
19
20
21
22
# File 'lib/flatware/cucumber/runtime.rb', line 18

def default_configuration
  config = ::Cucumber::Cli::Configuration.new
  config.parse! []
  config
end

#run(feature_files = [], options = []) ⇒ Object



24
25
26
27
28
29
30
31
32
33
# File 'lib/flatware/cucumber/runtime.rb', line 24

def run(feature_files=[], options=[])
  @loader = nil
  options = Array(feature_files) + %w[--format Flatware::Cucumber::Formatter] + options

  configure(::Cucumber::Cli::Main.new(options, out, err).configuration)

  self.visitor = configuration.build_tree_walker(self)
  visitor.visit_features(features)
  results
end