mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-13 10:41:38 -05:00
Fix visit suggesting job spec
This commit is contained in:
parent
3312ea794f
commit
1b6273ba1c
1 changed files with 17 additions and 5 deletions
|
|
@ -3,9 +3,9 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe VisitSuggestingJob, type: :job do
|
||||
describe '#perform' do
|
||||
let!(:users) { [create(:user)] }
|
||||
let!(:users) { [create(:user)] }
|
||||
|
||||
describe '#perform' do
|
||||
subject { described_class.perform_now }
|
||||
|
||||
before do
|
||||
|
|
@ -13,10 +13,22 @@ RSpec.describe VisitSuggestingJob, type: :job do
|
|||
allow_any_instance_of(Visits::Suggest).to receive(:call)
|
||||
end
|
||||
|
||||
it 'suggests visits' do
|
||||
subject
|
||||
context 'when user has no tracked points' do
|
||||
it 'does not suggest visits' do
|
||||
subject
|
||||
|
||||
expect(Visits::Suggest).to have_received(:new)
|
||||
expect(Visits::Suggest).not_to have_received(:new)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when user has tracked points' do
|
||||
let!(:tracked_point) { create(:point, user: users.first) }
|
||||
|
||||
it 'suggests visits' do
|
||||
subject
|
||||
|
||||
expect(Visits::Suggest).to have_received(:new)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue