Capybara 및 Rspec에서 best_in_place
필드를 테스트하려면 어떻게합니까? 나는 이것에 처음이에요.통합 테스트 : Best in Place, Capybara & RSpec
<span
class='best_in_place'
id='best_in_place_user_233952_name'
data-url='/users/233952'
data-object='user'
data-attribute='name'
data-nil='User Name'
data-type='textarea'
data-original-content=''>
</span>
이름이 적힌 텍스트 영역을 가장 잘 기입하고 싶습니다.
RSpec.configure do |config|
config.include BestInPlace::TestHelpers
end
:
나는 best in place test helpers를 사용하기 위해 내 spec_helper.rb
에 config.include BestInPlace::TestHelpers
를 추가했다 :
fill_in("best_in_place_user_#{user.id}_name", with: 'some text')
page.execute_script "$('#best_in_place_user_#{user.id}_name').trigger('keyup')"
[has_css?] (http://www.rubydoc.info/gems/capybara/1.1.2/Capybara/Node/Matchers#has_css%3F-instance_method) –