4 class PlainTextStoryRunner
5 # You can initialize a PlainTextStoryRunner with the path to the
6 # story file or a block, in which you can define the path using load.
10 # PlainTextStoryRunner.new('path/to/file')
12 # PlainTextStoryRunner.new do |runner|
13 # runner.load 'path/to/file'
16 @options = Hash === args.last ? args.pop : {}
17 @story_file = args.empty? ? nil : args.shift
18 yield self if block_given?
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)
34 story_text = File.read(@story_file)
35 parser.parse(story_text.split("\n"))
41 @step_group ||= Spec::Story::StepGroup.new
42 yield @step_group if block_given?