fixed failing places tests

This commit is contained in:
Aaro Koivukangas
2023-12-06 15:40:31 +02:00
parent 36a8355ef4
commit db2870bd60
+3
View File
@@ -2,6 +2,7 @@ require "rails_helper"
describe "Places" do describe "Places" do
it "displays a place if one is returned from the api" do it "displays a place if one is returned from the api" do
allow(Place).to receive(:weather).with("kumpula").and_return nil
allow(BeermappingApi).to receive(:places_in).with("kumpula").and_return( allow(BeermappingApi).to receive(:places_in).with("kumpula").and_return(
[ Place.new( name: "Oljenkorsi", id: 1 ) ] [ Place.new( name: "Oljenkorsi", id: 1 ) ]
) )
@@ -14,6 +15,7 @@ describe "Places" do
end end
it "displays all places if multiple are returned from the api" do it "displays all places if multiple are returned from the api" do
allow(Place).to receive(:weather).with("kumpula").and_return nil
allow(BeermappingApi).to receive(:places_in).with("kumpula").and_return( allow(BeermappingApi).to receive(:places_in).with("kumpula").and_return(
[ Place.new( name: "Oljenkorsi", id: 1 ), Place.new( name: "Emt mitä paikkoja kumpulassa on", id: 2), Place.new( name: ":D", id: 3) ] [ Place.new( name: "Oljenkorsi", id: 1 ), Place.new( name: "Emt mitä paikkoja kumpulassa on", id: 2), Place.new( name: ":D", id: 3) ]
) )
@@ -28,6 +30,7 @@ describe "Places" do
end end
it "displays 'No locations in _city_' if none is returned by the api" do it "displays 'No locations in _city_' if none is returned by the api" do
allow(Place).to receive(:weather).with("kumpula").and_return nil
allow(BeermappingApi).to receive(:places_in).with("kumpula").and_return( allow(BeermappingApi).to receive(:places_in).with("kumpula").and_return(
[] []
) )