0
アウトラインタイプの会話は:キュウリ私は、パラメータとして整数を取得するクラスメソッドをテストしようとして
Scenario Outline: submit guess
Given the code "<code>"
When I response "<answer>"
Then the result should be "<result>"
Scenarios: level one
| code | answer | result |
| 1 | 2 | 3 |
| 5 | 4 | 9 |
そして、ステップdifinitions:
When /^I response "([^"]*)"$/ do | response |
@result = @game.step(response)
end
def step(response)
if response < 10
私はキュウリのシナリオを作成します
私は、キュウリが私のメソッドにパラメータとしてStringを渡すので、私はエラーを取得するテストを実行しています。
どうすれば修正できますか?
私は、クラスメソッドのコードを修正することができます。
def step(response)
response = response.to_i
if response < 10
を、それはすべての私の既存のコードを中断します。
う - http://www.engineyard.com/blog/2009/cucumber-step-argument-transforms/ – iafonov