Class: Kikambii::Feature

Inherits:
Object
  • Object
show all
Defined in:
lib/kikambii/feature.rb

Constant Summary collapse

MAXIMUM_RETRIES =
3

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dependencies) ⇒ Feature

Returns a new instance of Feature.



7
8
9
# File 'lib/kikambii/feature.rb', line 7

def initialize(dependencies)
  @feature, @scenarios, @runner, @attemps = dependencies[:feature], dependencies[:scenarios], dependencies[:runner], 0
end

Instance Attribute Details

#attempsObject (readonly)

Returns the value of attribute attemps.



5
6
7
# File 'lib/kikambii/feature.rb', line 5

def attemps
  @attemps
end

#featureObject (readonly)

Returns the value of attribute feature.



5
6
7
# File 'lib/kikambii/feature.rb', line 5

def feature
  @feature
end

#runnerObject (readonly)

Returns the value of attribute runner.



5
6
7
# File 'lib/kikambii/feature.rb', line 5

def runner
  @runner
end

#scenariosObject (readonly)

Returns the value of attribute scenarios.



5
6
7
# File 'lib/kikambii/feature.rb', line 5

def scenarios
  @scenarios
end

Instance Method Details

#fail?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/kikambii/feature.rb', line 20

def fail?
  @scenarios.any?
end

#runObject



11
12
13
14
15
16
17
18
# File 'lib/kikambii/feature.rb', line 11

def run
  return true unless should_run?

  @scenarios.delete_if { |scenario| @runner.run command_for(scenario) }
  @attemps += 1

  @scenarios.empty?
end