I have a form which I am submitting using remote=>true
<%= form_tag fetch_data_path, :remote => true do %>
Date: <%= text_field_tag :date %>
Amount:<%= text_field_tag :amount %>
From:<%= text_field_tag :from %>
To:<%= text_field_tag :to %>
<%= submit_tag "Convert"%>
<% end %>
<span style="font-weight: bold;">Converted Amount:</span>
<div id="converted_amount"></div>
On submitting the form, the converted value is displayed in the div with id
#converted_amount
Here is my rspec:
RSpec.feature "User performs exchange", :type => :feature do
scenario "with valid input" do
visit exchanges_path
fill_in 'date', :with => "2017-08-24"
fill_in 'amount', :with => "100"
fill_in 'from', :with => "pound"
fill_in 'to', :with => "dollar"
click_button('Convert')
expect(page).to have_text("Converted Amount:")
end
end
The issue is that when I run it, I get
Capybara::ElementNotFound: Unable to find xpath "/html" and yet when I comment out click_button, it works.
What am I doing wrong?