2017-05-09 5 views
0

'보유'메소드에 대해 정의되지 않은 메소드 오류 메시지가 나타납니다.# <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 가정하면 대신 @gymhomepage.find_your_local_gym.first_gym_location이 요소가 이미 이미 범위가 보장 될 수 있기 때문에 그냥

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

을 할 필요가 범위 발견 방법 인 경우 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

Whalpole thats worked. 감사. –

관련 문제