Fix obsolete respond_with_bip usage
Since we removed the `best_in_place` gem, this method doesn't exist anymore. We're replacing it with what the method actually does. Note the test doesn't check the poll is correctly updated. We could add a `visit proposal_dashboard_polls_path(proposal)` before checking the "Show results" field, but then we would enter a race condition between this request and the AJAX request. A proper solution would be to provide actual feedback to the user so they know the poll has been updated, and then checking that feedback is present in the tests.
This commit is contained in:
@@ -35,10 +35,10 @@ class Dashboard::PollsController < Dashboard::BaseController
|
|||||||
if poll.update(poll_params)
|
if poll.update(poll_params)
|
||||||
format.html { redirect_to proposal_dashboard_polls_path(proposal),
|
format.html { redirect_to proposal_dashboard_polls_path(proposal),
|
||||||
notice: t("flash.actions.update.poll") }
|
notice: t("flash.actions.update.poll") }
|
||||||
format.json { respond_with_bip(poll) }
|
format.json { head :no_content }
|
||||||
else
|
else
|
||||||
format.html { render :edit }
|
format.html { render :edit }
|
||||||
format.json { respond_with_bip(poll) }
|
format.json { render json: poll.errors.full_messages, status: :unprocessable_entity }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -197,6 +197,19 @@ feature "Polls" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scenario "Enable and disable results", :js do
|
||||||
|
create(:poll, related: proposal)
|
||||||
|
|
||||||
|
visit proposal_dashboard_polls_path(proposal)
|
||||||
|
check "Show results"
|
||||||
|
|
||||||
|
expect(find_field("Show results")).to be_checked
|
||||||
|
|
||||||
|
uncheck "Show results"
|
||||||
|
|
||||||
|
expect(find_field("Show results")).not_to be_checked
|
||||||
|
end
|
||||||
|
|
||||||
scenario "Poll card" do
|
scenario "Poll card" do
|
||||||
poll = create(:poll, :expired, related: proposal)
|
poll = create(:poll, :expired, related: proposal)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user