From ed867fb2c084de24ce50e2b06373b5296b269359 Mon Sep 17 00:00:00 2001 From: Splines <37160523+Splines@users.noreply.github.com> Date: Wed, 5 Jun 2024 20:09:18 +0200 Subject: [PATCH] Make watchlist test cases a bit more robust (#650) --- spec/models/watchlist_entry_spec.rb | 10 ++++++---- spec/models/watchlist_spec.rb | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/spec/models/watchlist_entry_spec.rb b/spec/models/watchlist_entry_spec.rb index 4e938f777..f76eacda4 100644 --- a/spec/models/watchlist_entry_spec.rb +++ b/spec/models/watchlist_entry_spec.rb @@ -7,14 +7,16 @@ it "must have a medium" do entry = FactoryBot.build(:watchlist_entry, :with_watchlist) - entry.valid? - expect(entry.errors[:medium]).to include("muss ausgefüllt werden") + expect(entry).not_to be_valid + expect(entry.errors).to have_key(:medium) + expect(entry.errors).not_to have_key(:watchlist) end it "must have a watchlist" do entry = FactoryBot.build(:watchlist_entry, :with_medium) - entry.valid? - expect(entry.errors[:watchlist]).to include("muss ausgefüllt werden") + expect(entry).not_to be_valid + expect(entry.errors).to have_key(:watchlist) + expect(entry.errors).not_to have_key(:medium) end it "can only be once inside a watchlist" do diff --git a/spec/models/watchlist_spec.rb b/spec/models/watchlist_spec.rb index 5c511bf37..1432eccc2 100644 --- a/spec/models/watchlist_spec.rb +++ b/spec/models/watchlist_spec.rb @@ -7,8 +7,8 @@ it "must have a name" do watchlist = Watchlist.new(name: nil) - watchlist.valid? - expect(watchlist.errors[:name]).to include("muss ausgefüllt werden") + expect(watchlist).not_to be_valid + expect(watchlist.errors).to have_key(:name) end it "must have a unique name" do