From ccb80ce96705551aec6b1707e87cc32233d8c375 Mon Sep 17 00:00:00 2001 From: Bertocq Date: Tue, 3 Oct 2017 11:40:36 +0200 Subject: [PATCH] Fix recount spec to take into account already existing values and mandatory officer_assigment --- spec/models/poll/recount_spec.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spec/models/poll/recount_spec.rb b/spec/models/poll/recount_spec.rb index bec531d96..2a5ed16a7 100644 --- a/spec/models/poll/recount_spec.rb +++ b/spec/models/poll/recount_spec.rb @@ -3,7 +3,9 @@ require 'rails_helper' describe Poll::Recount do describe "logging changes" do - let(:poll_recount) { create(:poll_recount) } + let(:author) { create(:user) } + let(:officer_assignment) { create(:poll_officer_assignment) } + let(:poll_recount) { create(:poll_recount, author: author, officer_assignment: officer_assignment) } it "should update white_amount_log if white_amount changes" do poll_recount.white_amount = 33 @@ -69,7 +71,7 @@ describe Poll::Recount do poll_recount.save expect(poll_recount.white_amount_log).to eq(":0:33:32") - expect(poll_recount.officer_assignment_id_log).to eq(":101:102") + expect(poll_recount.officer_assignment_id_log).to eq(":#{officer_assignment.id}:101:102") end it "should update author_id if amount changes" do @@ -95,7 +97,7 @@ describe Poll::Recount do poll_recount.save! expect(poll_recount.white_amount_log).to eq(":0:33:32") - expect(poll_recount.author_id_log).to eq(":#{first_author.id}:#{second_author.id}:#{third_author.id}") + expect(poll_recount.author_id_log).to eq(":#{author.id}:#{first_author.id}:#{second_author.id}") end end