Skip to content

Commit

Permalink
Make watchlist test cases a bit more robust (#650)
Browse files Browse the repository at this point in the history
  • Loading branch information
Splines authored Jun 5, 2024
1 parent 0c841de commit ed867fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions spec/models/watchlist_entry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/models/watchlist_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ed867fb

Please sign in to comment.