Class: Lime::Step

Inherits:
Object
  • Object
show all
Defined in:
lib/lime/step.rb

Overview

Test step.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scenario, label, settings = {}) ⇒ Step

New unit test procedure.



9
10
11
12
13
14
15
16
17
# File 'lib/lime/step.rb', line 9

def initialize(scenario, label, settings={})
  @scenario = scenario
  @label    = label

  @type     = settings[:type]

  @omit     = false
  #@tested   = false
end

Instance Attribute Details

#labelObject (readonly)

Label of test.



26
27
28
# File 'lib/lime/step.rb', line 26

def label
  @label
end

#scenarioObject (readonly)

The scenario to which this step belongs.



23
24
25
# File 'lib/lime/step.rb', line 23

def scenario
  @scenario
end

#typeObject (readonly)

The type of step (:given, :when or :then).



20
21
22
# File 'lib/lime/step.rb', line 20

def type
  @type
end

Instance Method Details

#callObject



58
59
60
# File 'lib/lime/step.rb', line 58

def call
  scenario.run(self)
end

#omit=(boolean) ⇒ Object



34
35
36
# File 'lib/lime/step.rb', line 34

def omit=(boolean)
  @omit = boolean
end

#omit?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/lime/step.rb', line 29

def omit?
  @omit
end

#subjectObject

FIXME



44
45
# File 'lib/lime/step.rb', line 44

def subject
end

#to_procObject



48
49
50
# File 'lib/lime/step.rb', line 48

def to_proc
  lambda{ call }
end

#to_sObject



39
40
41
# File 'lib/lime/step.rb', line 39

def to_s
  "#{type.to_s.capitalize} #{label}"
end