RSpec Stories newlines not well digested
Reported by Swombat | May 31st, 2008 @ 02:24 AM | in No-Milestone-Assigned
This happens with latest trunk, just updated today - didn't happen before the update.
Story extract:
FileReference Load (0.001284) SELECT * FROM `file_references` WHERE (`file_references`.`original_filename` = 'file-ZFile2\n\n.txt') LIMIT 1
Scenario: Requests the same zipped download link twice
Given a signed up and confirmed user identified as Paul
When user Paul logs in
And creates a project identified as CompanyProject
And creates a quick-folder identified as QFolder for company Default
And uploads a quick-file as ZFile1 in quick-folder QFolder
And uploads a quick-file as ZFile2 in quick-folder QFolder
And requests to download file references identified as ZFile1 and ZFile2 in a zip file
And requests to download file references identified as ZFile1 and ZFile2 in a zip file
Then the database should contain just one zip download link for ZFile1 and ZFile2
Before, this worked. Now, it gives the following error:
1) file reference api (Requests the same zipped download link twice) FAILED
NoMethodError: You have a nil object when you didn't expect it!
The error occurred while evaluating nil.zip_download_links
./matchers/file_reference_steps.rb:32:in `the database should contain just one zip download link for $file1 and $file2'
file_reference_api.rb:13
This can easily be traced to be due to the new line characters not being handled properly (from the logs):
FileReference Load (0.002997) SELECT * FROM `file_references` WHERE (`file_references`.`original_filename` = 'file-ZFile1.txt') LIMIT 1
ZipDownloadLink Load (0.001359) SELECT `zip_download_links`.* FROM `zip_download_links` INNER JOIN zip_download_link_file_references ON zip_download_links.id = zip_download_link_file_references.zip_download_link_id WHERE ((`zip_download_link_file_references`.file_reference_id = 29579))
FileReference Load (0.001284) SELECT * FROM `file_references` WHERE (`file_references`.`original_filename` = 'file-ZFile2\n\n.txt') LIMIT 1
SQL (0.038641) ROLLBACK
This only happens on the last story in a scenario, if that is followed by a commented section. I have put in place some workarounds (e.g. another step afterwards which does not depend on any params), but I imagine this should be fixed properly.
To reproduce: Create a scenario file which has an end-of-line parameter on the last line of its last story, followed by some commented lines. The additional \n can easily be spotted in the parameter passed to the matcher.
Daniel
Comments and changes to this ticket
-
Pat Maddox October 21st, 2008 @ 12:54 AM
- → State changed from new to out-of-date
- → Tag changed from to bug matchers plaintext regression story storyframework
no more story runner
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Behaviour Driven Development for Ruby.
