From d36fbf85f4b3fdb79ada1675871407757629cf91 Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Sun, 29 Oct 2023 20:42:37 +0100 Subject: [PATCH] Reload target before checking smile count --- spec/lib/use_case/reaction/create_spec.rb | 2 +- spec/lib/use_case/reaction/destroy_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/lib/use_case/reaction/create_spec.rb b/spec/lib/use_case/reaction/create_spec.rb index a438f108..243b227a 100644 --- a/spec/lib/use_case/reaction/create_spec.rb +++ b/spec/lib/use_case/reaction/create_spec.rb @@ -5,7 +5,7 @@ require "rails_helper" describe UseCase::Reaction::Create do shared_examples_for "valid target type" do it "creates a reaction" do - expect { subject }.to change { target.smile_count }.by(1) + expect { subject }.to change { target.reload.smile_count }.by(1) end end diff --git a/spec/lib/use_case/reaction/destroy_spec.rb b/spec/lib/use_case/reaction/destroy_spec.rb index 44c0e9a2..f979db66 100644 --- a/spec/lib/use_case/reaction/destroy_spec.rb +++ b/spec/lib/use_case/reaction/destroy_spec.rb @@ -9,7 +9,7 @@ describe UseCase::Reaction::Destroy do end it "destroys a reaction" do - expect { subject }.to change { target.smile_count }.by(-1) + expect { subject }.to change { target.reload.smile_count }.by(-1) end end