Module: ViewSpec::DSL::Scenarios

Extended by:
ActiveSupport::Concern
Included in:
GroupContext, SpecContext
Defined in:
lib/view_spec/dsl/scenarios.rb

Instance Method Summary collapse

Instance Method Details

#scenario(name, &block) ⇒ Object



16
17
18
19
# File 'lib/view_spec/dsl/scenarios.rb', line 16

def scenario(name, &block)
  entries << Scenario.new(name, @entry, cascading_values, &block)
  entries.last
end

#scenarios(flatten: false) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/view_spec/dsl/scenarios.rb', line 5

def scenarios(flatten: false)
  items = entries.map do |entry|
    if entry.type == :scenario
      entry
    elsif flatten && entry.type == :group
      entry.scenarios.to_a
    end
  end.compact.flatten
  ScenarioCollection.new(items.to_a)
end