2017-05-09 5 views
0

' have 'メソッドの定義されていないメソッドエラーメッセージが表示されます。未定義メソッド `have 'for#<Object:0x007f997fabf778>(NoMethodError)

expect(@gymhomepage.find_your_local_gym).to have(@gymhomepage.find_your_local_gym.first_gym_location)

私はfirst_gym_locationのCSSはfind_your_local_gymセクション内に配置されている場合主張しようとしています。

Please see my framework on Github

誰もが何か提案はありますか?

+0

Githubであなたのプロジェクト全体を読む人は誰もいません。含まれています。 –

答えて

1

カピバラはhaveマッチャーを提供していません。これはhave_<something>マッチャーの束を提供します。代わりに@gymhomepage.find_your_local_gym.first_gym_location要素がすでにあなたはちょうどすでにスコープされることが保証されるため

expect(@gymhomepage.find_your_local_gym.first_gym_location).to be 

を行う必要があるスコープ見つけた方法であれば@gymhomepage.find_your_local_gym.first_gym_location返しますCSSセレクタと仮定すると、あなたは

expect(@gymhomepage.find_your_local_gym).to have_css(@gymhomepage.find_your_local_gym.first_gym_location) 

を使用しますfind_your_local_gym要素にそれを呼んで(XPathのトラップに入っていないと仮定すると - https://github.com/teamcapybara/capybara#beware-the-xpath--trap

+0

ホワールポールは働いています。ありがとう。 –

関連する問題