3

ブラウザでテキストをはっきりと見ることができます。

characters should be "R", "P", or "B".

しかし、ステップをキュウリステップと書くとき

Then I should see "characters should be \"R\", \"P\", or \"B\"."

それは言う

Undefined step: "I should see "characters should be \"R\", \"P\", or \"B\"."" (Cucumber::Undefined)

そして、ステップを次のように定義すると言います

Then /^I should see "([^"]*)"R\\"([^"]*)"P\\"([^"]*)"B\\"([^"]*)"$/ do |arg1, arg2, arg3, arg4|
    pending # express the regexp above with the code you wish you had
end

きゅうりがこのステップを認識しないのはなぜですか?

それとも、引用符内の引用符のエスケープの問題ですか?

ありがとう

4

1 に答える 1

0

Pystring が機能する可能性があります。3 つの二重引用符を使用して、行全体を文字列として示します。

キュウリステップ

Then I should see
"""
characters should be "R", "P", or "B".
"""

ステップ定義

Then /^I should see "([^"]*)"$/ do |string|
  pending # express the regexp above with the code you wish you had
end
于 2012-07-17T01:50:41.743 に答える