Class: Neo::Rails::Scenarios::Scenario

Inherits:
Object
  • Object
show all
Defined in:
lib/neo/rails/scenarios.rb

Overview

A simple class encapsulating a scenario:

  • the corresponding action

  • the scenario’s name

  • an humanized name as label

  • the blocked which will be called when applying a scenario

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(action, name, block, options) ⇒ Scenario

Returns a new instance of Scenario.



100
101
102
103
104
105
# File 'lib/neo/rails/scenarios.rb', line 100

def initialize(action, name, block, options)
  @action   = action.to_sym
  @name     = name.to_sym
  @block    = block
  @options  = options
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



98
99
100
# File 'lib/neo/rails/scenarios.rb', line 98

def action
  @action
end

#blockObject (readonly)

Returns the value of attribute block.



98
99
100
# File 'lib/neo/rails/scenarios.rb', line 98

def block
  @block
end

#nameObject (readonly)

Returns the value of attribute name.



98
99
100
# File 'lib/neo/rails/scenarios.rb', line 98

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



98
99
100
# File 'lib/neo/rails/scenarios.rb', line 98

def options
  @options
end

Instance Method Details

#labelObject



107
108
109
# File 'lib/neo/rails/scenarios.rb', line 107

def label
  "#{@action.to_s.humanize} -> #{@name.to_s.humanize}"
end