Reputation: 39
I'm writing some tests for my project and having some issues. In the test, I'm just filling some fields and I want to submit this form. It works in the browser but in the test, I got a formatError
. Here is the Error:
ActionController::UnknownFormat: CompaniesController#update is missing a template for this request format and variant.
request.formats: ["text/html"]
request.variant: []
The little test:
scenario 'update company with valid params' do
visit company_account_information_path
fill_in 'company_name', with: "Mustername für Firma"
fill_in 'company_owner_name', with: "Mustermann"
click_button "Speichern"
end
I didn't add some expectations yet because it is failing every time.
EDIT:
Yes, the response is js! It should open a modal.
Upvotes: 0
Views: 171
Reputation: 133
To js tests you need to specify js: true
in scenario and should config a webdriver like selenium or poltergeist to execute js with capybara.
Your test:
scenario 'update company with valid params', js: true do
visit company_account_information_path
fill_in 'company_name', with: "Mustername für Firma"
fill_in 'company_owner_name', with: "Mustermann"
click_button "Speichern"
end
Read this doc to configure a webdriver that supports js Capybara drivers
Upvotes: 1