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

result_matchers_spec.rb « matchers « support_specs « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0c30dd08009728ba3540ad661f80f475791aea20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

require 'fast_spec_helper'

require_relative '../../../spec/support/matchers/result_matchers'

RSpec.describe 'result matchers', feature_category: :remote_development do
  include ResultMatchers

  it 'works with value asserted via argument' do
    expect(Result.ok(1)).to be_ok_result(1)
    expect(Result.ok(1)).not_to be_ok_result(2)
    expect(Result.ok(1)).not_to be_err_result(1)
  end

  it 'works with value asserted via block' do
    expect(Result.err('hello')).to be_err_result do |result_value|
      expect(result_value).to match(/hello/i)
    end
  end
end