Class: RSpec::Steps::Step

Inherits:
Struct
  • Object
show all
Defined in:
lib/rspec-steps/step.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*whatever) ⇒ Step

Returns a new instance of Step.



3
4
5
6
# File 'lib/rspec-steps/step.rb', line 3

def initialize(*whatever)
  super
  @failed_step = nil
end

Instance Attribute Details

#actionObject

Returns the value of attribute action

Returns:

  • (Object)

    the current value of action



2
3
4
# File 'lib/rspec-steps/step.rb', line 2

def action
  @action
end

#argsObject

Returns the value of attribute args

Returns:

  • (Object)

    the current value of args



2
3
4
# File 'lib/rspec-steps/step.rb', line 2

def args
  @args
end

#failed_stepObject

Returns the value of attribute failed_step.



7
8
9
# File 'lib/rspec-steps/step.rb', line 7

def failed_step
  @failed_step
end

#metadataObject

Returns the value of attribute metadata

Returns:

  • (Object)

    the current value of metadata



2
3
4
# File 'lib/rspec-steps/step.rb', line 2

def 
  @metadata
end

Instance Method Details

#define_on(step_list, example_group) ⇒ Object



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

def define_on(step_list, example_group)
  step = self
  example_group.it(*args, ) do |example|
    step_list.run_only_once(self)
    result = step_list.result_for(step)
    pending if result.is_after_failed_step?
    expect(result).to have_executed_successfully
  end
end

#run_inside(example) ⇒ Object



19
20
21
# File 'lib/rspec-steps/step.rb', line 19

def run_inside(example)
  example.instance_eval(&action)
end