mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 01:31:39 -05:00
Fix trips spec
This commit is contained in:
parent
ce88452be0
commit
dca27b319c
1 changed files with 20 additions and 3 deletions
|
|
@ -76,7 +76,7 @@ RSpec.describe Trip, type: :model do
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
let(:user) { create(:user) }
|
let(:user) { create(:user, settings: settings) }
|
||||||
let(:trip) { create(:trip, user:) }
|
let(:trip) { create(:trip, user:) }
|
||||||
let(:expected_photos) do
|
let(:expected_photos) do
|
||||||
[
|
[
|
||||||
|
|
@ -89,8 +89,25 @@ RSpec.describe Trip, type: :model do
|
||||||
allow_any_instance_of(Immich::RequestPhotos).to receive(:call).and_return(photo_data)
|
allow_any_instance_of(Immich::RequestPhotos).to receive(:call).and_return(photo_data)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns the photos' do
|
context 'when Immich integration is not configured' do
|
||||||
expect(trip.photos).to eq(expected_photos)
|
let(:settings) { {} }
|
||||||
|
|
||||||
|
it 'returns an empty array' do
|
||||||
|
expect(trip.photos).to eq([])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when Immich integration is configured' do
|
||||||
|
let(:settings) do
|
||||||
|
{
|
||||||
|
immich_url: 'https://immich.example.com',
|
||||||
|
immich_api_key: '1234567890'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns the photos' do
|
||||||
|
expect(trip.photos).to eq(expected_photos)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue