Class Spec::Story::Runner::StoryParser::State
In: lib/spec/story/runner/story_parser.rb
Parent: Object

Methods

eof   event   given   given_scenario   new   other   outcome   remove_tag_from   scenario   story  

Public Class methods

[Source]

    # File lib/spec/story/runner/story_parser.rb, line 92
92:           def initialize(parser)
93:             @parser = parser
94:           end

Public Instance methods

[Source]

     # File lib/spec/story/runner/story_parser.rb, line 133
133:           def eof
134:           end

[Source]

     # File lib/spec/story/runner/story_parser.rb, line 116
116:           def event(line)
117:             @parser.create_when(remove_tag_from(:when, line))
118:             @parser.transition_to(:when_state)
119:           end

[Source]

     # File lib/spec/story/runner/story_parser.rb, line 106
106:           def given(line)
107:             @parser.create_given(remove_tag_from(:given, line))
108:             @parser.transition_to(:given_state)
109:           end

[Source]

     # File lib/spec/story/runner/story_parser.rb, line 111
111:           def given_scenario(line)
112:             @parser.create_given_scenario(remove_tag_from(:givenscenario, line))
113:             @parser.transition_to(:given_state)
114:           end

[Source]

     # File lib/spec/story/runner/story_parser.rb, line 136
136:           def other(line)
137:             # no-op - supports header text before the first story in a file
138:           end

[Source]

     # File lib/spec/story/runner/story_parser.rb, line 121
121:           def outcome(line)
122:             @parser.create_then(remove_tag_from(:then, line))
123:             @parser.transition_to(:then_state)
124:           end

[Source]

     # File lib/spec/story/runner/story_parser.rb, line 126
126:           def remove_tag_from(tag, line)
127:             tokens = line.split
128:             # validation of tag can go here
129:             tokens[0].downcase.match(/#{tag.to_s}:?/) ? 
130:                                 (tokens[1..-1].join(' ')) : line
131:           end

[Source]

     # File lib/spec/story/runner/story_parser.rb, line 101
101:           def scenario(line)
102:             @parser.create_scenario(line)
103:             @parser.transition_to(:scenario_state)
104:           end

[Source]

    # File lib/spec/story/runner/story_parser.rb, line 96
96:           def story(line)
97:             @parser.init_story(line)
98:             @parser.transition_to(:story_state)
99:           end

[Validate]