Module: LucidOperation::Steps

Defined in:
lib/isomorfeus_operation/lucid_operation/steps.rb

Instance Method Summary collapse

Instance Method Details

#Ensure(regular_expression, &block) ⇒ Object



46
47
48
# File 'lib/isomorfeus_operation/lucid_operation/steps.rb', line 46

def Ensure(regular_expression, &block)
  ensure_steps << [regular_expression, block]
end

#ensure_stepsObject



15
16
17
# File 'lib/isomorfeus_operation/lucid_operation/steps.rb', line 15

def ensure_steps
  @ensure_steps ||= []
end

#Failed(regular_expression, &block) ⇒ Object Also known as: If_failing, When_failing, If_this_failed, If_that_failed



50
51
52
# File 'lib/isomorfeus_operation/lucid_operation/steps.rb', line 50

def Failed(regular_expression, &block)
  failure_steps << [regular_expression, block]
end

#failure_stepsObject



19
20
21
# File 'lib/isomorfeus_operation/lucid_operation/steps.rb', line 19

def failure_steps
  @failure_steps ||= []
end

#Finally(regular_expression, &block) ⇒ Object



40
41
42
43
44
# File 'lib/isomorfeus_operation/lucid_operation/steps.rb', line 40

def Finally(regular_expression, &block)
  Isomorfeus.raise_error(message: "#{self}: Finally already defined, can only be defined once!") if @finally_defined
  @finally_defined = true
  steps << [regular_expression, block]
end

#First(regular_expression, &block) ⇒ Object



27
28
29
30
31
# File 'lib/isomorfeus_operation/lucid_operation/steps.rb', line 27

def First(regular_expression, &block)
  Isomorfeus.raise_error(message: "#{self}: First already defined, can only be defined once!") if @first_defined
  @first_defined = true
  steps << [regular_expression, block]
end

#gherkinObject



11
12
13
# File 'lib/isomorfeus_operation/lucid_operation/steps.rb', line 11

def gherkin
  @gherkin ||= LucidOperation::Gherkin.parse(@procedure)
end

#Given(regular_expression, &block) ⇒ Object Also known as: And, Then, When



33
34
35
# File 'lib/isomorfeus_operation/lucid_operation/steps.rb', line 33

def Given(regular_expression, &block)
  steps << [regular_expression, block]
end

#procedure(gherkin_text) ⇒ Object



5
6
7
8
9
# File 'lib/isomorfeus_operation/lucid_operation/steps.rb', line 5

def procedure(gherkin_text)
  feature_line = gherkin_text.include?('Operation: ') ? '' : "Operation: #{self.name}\n"
  scenario_line = feature_line == '' || gherkin_text.include?('Procedure: ') ? '' : "  Procedure: #{self.name} executing\n"
  @procedure = feature_line + scenario_line + gherkin_text
end

#stepsObject



23
24
25
# File 'lib/isomorfeus_operation/lucid_operation/steps.rb', line 23

def steps
  @steps ||= []
end