Welcome to mirror list, hosted at ThFree Co, Russian Federation.

create_service_shared_examples.rb « boards « services « shared_examples « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 63b5e3a5a84b4368e91ba5b4dc70e80ffe69639c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

RSpec.shared_examples 'boards recent visit create service' do
  let_it_be(:user) { create(:user) }

  subject(:service) { described_class.new(board.resource_parent, user) }

  it 'returns nil when there is no user' do
    service.current_user = nil

    expect(service.execute(board)).to be_nil
  end

  it 'returns nil when database is read only' do
    allow(Gitlab::Database).to receive(:read_only?) { true }

    expect(service.execute(board)).to be_nil
  end

  it 'records the visit' do
    expect(model).to receive(:visited!).once

    service.execute(board)
  end
end