Methods
Public Class methods
You can initialize a PlainTextStoryRunner with the path to the story file or a block, in which you can define the path using load.
Examples
PlainTextStoryRunner.new('path/to/file')
PlainTextStoryRunner.new do |runner|
runner.load 'path/to/file'
end
[ show source ]
# File lib/spec/story/runner/plain_text_story_runner.rb, line 15
15: def initialize(*args)
16: @options = Hash === args.last ? args.pop : {}
17: @story_file = args.empty? ? nil : args.shift
18: yield self if block_given?
19: end
Public Instance methods
[ show source ]
# File lib/spec/story/runner/plain_text_story_runner.rb, line 21
21: def []=(key, value)
22: @options[key] = value
23: end
[ show source ]
# File lib/spec/story/runner/plain_text_story_runner.rb, line 25
25: def load(path)
26: @story_file = path
27: end
[ show source ]
# File lib/spec/story/runner/plain_text_story_runner.rb, line 29
29: def run
30: raise "You must set a path to the file with the story. See the RDoc." if @story_file.nil?
31: mediator = Spec::Story::Runner::StoryMediator.new(steps, Spec::Story::Runner.story_runner, @options)
32: parser = Spec::Story::Runner::StoryParser.new(mediator)
33:
34: story_text = File.read(@story_file)
35: parser.parse(story_text.split("\n"))
36:
37: mediator.run_stories
38: end
[ show source ]
# File lib/spec/story/runner/plain_text_story_runner.rb, line 40
40: def steps
41: @step_group ||= Spec::Story::StepGroup.new
42: yield @step_group if block_given?
43: @step_group
44: end