Module: Marso::StoryLoad

Included in:
Story
Defined in:
lib/marso/domain/story/story_load.rb

Instance Method Summary collapse

Instance Method Details

#load(mode = :scenario_contexts) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/marso/domain/story/story_load.rb', line 6

def load(mode=:scenario_contexts)
  new_ctx = self.ctx.clone
  new_ctx[:story_id] = self.id
  file_path_pattern = File.join(self.rootpath, 'scenarios/*.rb')

  scenario_ctxs = Marso.load_components(:scenario_context, file_path_pattern, new_ctx)

  new_description = self.description.clone
  new_description[:scenario_contexts] = scenario_ctxs
  return Story.new(new_description, new_ctx)
end