summaryrefslogtreecommitdiff
path: root/spec/lib/atlassian/jira_connect/serializers/base_entity_spec.rb
blob: d7672c0baf1b702494f5c5894c80fbf82388a113 (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
26
27
28
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Atlassian::JiraConnect::Serializers::BaseEntity do
  let(:update_sequence_id) { nil }

  subject do
    described_class.represent(
      anything,
      update_sequence_id: update_sequence_id
    )
  end

  it 'generates the update_sequence_id' do
    allow(Atlassian::JiraConnect::Client).to receive(:generate_update_sequence_id).and_return(1)

    expect(subject.value_for(:updateSequenceId)).to eq(1)
  end

  context 'with update_sequence_id option' do
    let(:update_sequence_id) { 123 }

    it 'uses the custom update_sequence_id' do
      expect(subject.value_for(:updateSequenceId)).to eq(123)
    end
  end
end