When I click 'Log In' on the navbar a modal dialog pops up rendering the log in partial.
How would I go about testing this using RSpec and Capybara?
<!--....-->
<li><%= link_to "Log in", '#', data: {:'reveal-id' => 'loginModal'} %></li>
<!--....-->
<div id="loginModal" class="reveal-modal">
<%= render 'devise/sessions/new' %>
<a class="close-reveal-modal">×</a>
</div>
Try:
visit your_page_path
click_link "Log in"
page.should have_content('a_modal_content_here') # async
Please consider using the following,
within('#loginModal') do
page.should have_content('a_modal_content_here') # async
end
to look for your content in the modal only.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With