遵循gem development guide,我来到了检查文件内容的部分。因为有磅和多行,所以要检查的内容用\#
and转义\n
。
Scenario: Recipes # features/generator.feature:6
When I run `foodie recipe dinner steak` # aruba-0.5.3/lib/aruba/cucumber.rb:60
Then the following files should exist: # aruba-0.5.3/lib/aruba/cucumber.rb:256
| dinner/steak.txt |
Then the file "dinner/steak.txt" should contain: # aruba-0.5.3/lib/aruba/cucumber.rb:300
"""
##### Ingredients #####
Ingredients for delicious steak go here.
##### Instructions #####
Tips on how to make delicious steak go here.
"""
expected: /\#\#\#\#\#\ Ingredients\ \#\#\#\#\#\nIngredients\ for\ delicious\ steak\ go\ here\.\n\n\n\#\#\#\#\#\ Instructions\ \#\#\#\#\#\nTips\ on\ how\ to\ make\ delicious\ steak\ go\ here\./
got: "#### Ingredients ####\nIngredients for delicious steak go here.\n\n\n#### Indtructions ####\nTips on how to make delicious steak go here.\n" (using =~)
Diff:
@@ -1,2 +1,7 @@
-/\#\#\#\#\#\ Ingredients\ \#\#\#\#\#\nIngredients\ for\ delicious\ steak\ go\ here\.\n\n\n\#\#\#\#\#\ Instructions\ \#\#\#\#\#\nTips\ on\ how\ to\ make\ delicious\ steak\ go\ here\./
+#### Ingredients ####
+Ingredients for delicious steak go here.
+
+
+#### Indtructions ####
+Tips on how to make delicious steak go here.
(RSpec::Expectations::ExpectationNotMetError)
features/generator.feature:10:in `Then the file "dinner/steak.txt" should contain:'
Failing Scenarios:
cucumber features/generator.feature:6 # Scenario: Recipes
3 scenarios (1 failed, 2 passed)
7 steps (1 failed, 6 passed)
0m0.950s
是不是我做错了什么,或者本指南是否较旧,我应该采取其他措施来防止文件检查转义文本?
更新:
如果我将文件和测试更改为一行并删除井号字符,则测试将通过。
Scenario: Recipes # features/generator.feature:6
When I run `foodie recipe dinner steak` # aruba-0.5.3/lib/aruba/cucumber.rb:60
Then the following files should exist: # aruba-0.5.3/lib/aruba/cucumber.rb:256
| dinner/steak.txt |
Then the file "dinner/steak.txt" should contain: # aruba-0.5.3/lib/aruba/cucumber.rb:300
"""
Ingredients: Delicious steak ingredients go here.
"""