summaryrefslogtreecommitdiff
path: root/spec/models/approval_spec.rb
blob: e2c0d5faa077893c7c82d65ae284ef46987f26d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Approval do
  context 'presence validation' do
    it { is_expected.to validate_presence_of(:merge_request_id) }
    it { is_expected.to validate_presence_of(:user_id) }
  end

  context 'uniqueness validation' do
    let!(:existing_record) { create(:approval) }

    it { is_expected.to validate_uniqueness_of(:user_id).scoped_to([:merge_request_id]) }
  end
end