Class | Spec::Story::Runner::PlainTextStoryRunner
In: | lib/spec/story/runner/plain_text_story_runner.rb
Parent: | Object

### Methods

[]= load new run steps

### Public Class methods

new(*args) {|self if block_given?| ...}

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

[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

[]=(key, value)

[Source]

        # File lib/spec/story/runner/plain_text_story_runner.rb, line 21
    21:         def []=(key, value)
    22:           @options[key] = value
    23:         end

load(path)

[Source]

        # File lib/spec/story/runner/plain_text_story_runner.rb, line 25
    25:         def load(path)
    26:           @story_file = path
    27:         end

run(story_runner=Spec::Story::Runner.story_runner)

[Source]

        # File lib/spec/story/runner/plain_text_story_runner.rb, line 29
    29:         def run(story_runner=Spec::Story::Runner.story_runner)
    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, 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

steps() {|@step_group if block_given?| ...}

[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

[Validate]