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

service_response_shared_examples.rb « services « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 186627347fbf56fa79575a0ac86486ff68795a5e (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 'returning an error service response' do |message: nil|
  it 'returns an error service response' do
    result = subject

    expect(result).to be_error

    if message
      expect(result.message).to eq(message)
    end
  end
end

RSpec.shared_examples 'returning a success service response' do |message: nil|
  it 'returns a success service response' do
    result = subject

    expect(result).to be_success

    if message
      expect(result.message).to eq(message)
    end
  end
end