VERSION: rspec rails plugin current edge version<br>XP/Cygwin on XP<br><br>Hi,<br>I hit this when trying to use parenthesis in my stories ... (that'll teach me!).<br><br>If a scenario looks like the following:<br><br>
Story "User has story with parentheses", %{<br> As a user<br> I want parenthesis<br> So that ... well I just do <br>}, :type => RailsStory do<br><br> Scenario "the Given has parentheses" do<br>
Given "parenthesis () in the given " do<br> end<br><br> When "anything" do<br> end<br> <br> Then "The error occurred while evaluating nil.perform " do<br> end<br> <br> end
<br>end<br clear="all"><br>This fails with the following:<br><br>The error occurred while evaluating nil.perform<br> /cygdrive/c/development/sandbox/prototypes/proj/config/../vendor/plugins/rspec/lib/spec/story/world.rb: 60:in `store_and_call'
<br>/cygdrive/c/development/sandbox/prototypes/proj/config/../vendor/plugins/rspec/lib/spec/story/world.rb: 92:in `Given'<br>stories/parenthesis_error_story.rb:10<br><br><br>Looks like the problem is in the Step#matches? method
<br>since <br> "abc (re) def".match /abc (re) def/ <br>returns nil<br>however <br> "abc (re) def".match /abc \(re\) def/<br>returns the match<br><br>The Step#assign_expression method when modifed as follows
<br><br> def assign_expression(name)<br> expression = name.dup<br> if String === expression<br> while expression =~ /(\$\w*)/<br> expression.gsub!($1, "(.*)")<br>
end<br> <br> expression.gsub! '(', '\(' # here<br> expression.gsub! ')', '\)' # here<br><br> end<br> @expression = Regexp.new
("^#{expression}$")<br> end<br><br>Then the specs pass.<br><br>This has been here for a couple of weeks just got round to debugging.<br><br>HTH<br>heers!<br>sinclair