public
Description: Behaviour Driven Development framework for Ruby
Homepage: http://rspec.info
Clone URL: git://github.com/dchelimsky/rspec.git
Click here to lend your support to: rspec and make a donation at www.pledgie.com !
Fix for Story runner that handles the case when plaintext steps are read in with 
unintentional
new lines and the end of them (due to comments) resulting in StepMother not 
being able to find
the step's implementation.
bmabey (author)
Fri Jul 18 22:38:45 -0700 2008
dchelimsky (committer)
Sat Jul 19 08:03:20 -0700 2008
commit  dc359c78147166bc9688ea49a5ebf237478e6f24
tree    35fc71a9621f27c63ca32fba6169c24d215166b0
parent  134c0f94e94f89938a941af5d74d9b303036fe08
...
19
20
21
22
 
23
24
25
26
 
27
28
29
...
19
20
21
 
22
23
24
25
 
26
27
28
29
0
@@ -19,11 +19,11 @@ module Spec
0
       end
0
 
0
       def matches?(name)
0
-        !(matches = name.match(@expression)).nil?
0
+        !(name.strip =~ @expression).nil?
0
       end
0
             
0
       def parse_args(name)
0
-        name.match(@expression)[1..-1]
0
+        name.strip.match(@expression)[1..-1]
0
       end
0
 
0
       private
...
2
3
4
5
 
6
7
8
9
10
 
 
 
 
 
11
12
13
...
133
134
135
136
 
137
138
139
...
158
159
160
 
 
 
 
 
 
 
 
 
 
 
 
161
162
163
...
2
3
4
 
5
6
7
8
9
10
11
12
13
14
15
16
17
18
...
138
139
140
 
141
142
143
144
...
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
0
@@ -2,12 +2,17 @@ require File.dirname(__FILE__) + '/story_helper'
0
 
0
 module Spec
0
   module Story
0
-    describe Step, "matching" do
0
+    describe Step, "#matching" do
0
       it "should match a text string" do
0
         step = Step.new("this text") {}
0
         step.matches?("this text").should be_true
0
       end
0
       
0
+      it "should match a text string that has additional line returns" do
0
+        step = Step.new("this text") {}
0
+        step.matches?("this text\n\n").should be_true
0
+      end
0
+      
0
       it "should not match a text string that does not start the same" do
0
         step = Step.new("this text") {}
0
         step.matches?("Xthis text").should be_false
0
@@ -133,7 +138,7 @@ module Spec
0
       end
0
       
0
       it "should match a multiline regex" do
0
-        step = Step.new(/.* should have text.$text/) {}
0
+        step = Step.new(/.*should have text.$text/) {}
0
         step.matches?(<<TEXT).should be_true
0
           should have text
0
           this is the text
0
@@ -158,6 +163,18 @@ TEXT
0
       end
0
     end
0
     
0
+    describe Step, "#parse_args" do
0
+      it "should return an empty array for a text string with no parameters" do
0
+        step = Step.new("this text") {}
0
+        step.parse_args("this text").should == []
0
+      end
0
+      
0
+      it "should return an empty array for a text string with additional line returns and no parameters" do
0
+        step = Step.new("this text") {}
0
+        step.parse_args("this text\n\n").should == []
0
+      end
0
+    end
0
+    
0
     describe Step do
0
       it "should be pending with no block" do
0
         step = Step.new("foo")

Comments