Skip to content

Commit

Permalink
Fix error messages for question answer images
Browse files Browse the repository at this point in the history
Since we were creating a new answer in the form, we weren't getting the
errors associated to the answer the administrator was trying to create,
and so we were skipping the test.

Using the answer which contains the information about validation errors
fixes the issue and so we don't have to skip the tests.
  • Loading branch information
javierm committed Apr 7, 2022
1 parent 00fe81b commit 5864044
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/views/admin/poll/questions/answers/images/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="poll-question-form">
<%= form_for(Poll::Question::Answer.new,
<%= form_for(@answer,
url: admin_answer_images_path(@answer),
method: :post) do |f| %>
<%= render "shared/errors", resource: @answer %>
Expand Down
8 changes: 2 additions & 6 deletions spec/shared/system/nested_imageable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,8 @@
click_link "Add image"
click_on submit_button

if has_many_images
# Pending. Review soon and test
else
within "#nested-image .image" do
expect(page).to have_content("can't be blank", count: 2)
end
within "#nested-image .image" do
expect(page).to have_content("can't be blank", count: 2)
end
end

Expand Down

0 comments on commit 5864044

Please sign in to comment.