2019-07-25 01:21:37 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-12-12 13:41:55 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 05:08:32 -04:00
|
|
|
RSpec.describe Bitbucket::Representation::PullRequestComment do
|
2016-12-12 13:41:55 -05:00
|
|
|
describe '#iid' do
|
|
|
|
it { expect(described_class.new('id' => 1).iid).to eq(1) }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#file_path' do
|
|
|
|
it { expect(described_class.new('inline' => { 'path' => '/path' }).file_path).to eq('/path') }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#old_pos' do
|
|
|
|
it { expect(described_class.new('inline' => { 'from' => 3 }).old_pos).to eq(3) }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#new_pos' do
|
|
|
|
it { expect(described_class.new('inline' => { 'to' => 3 }).new_pos).to eq(3) }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#parent_id' do
|
2016-12-14 13:19:26 -05:00
|
|
|
it { expect(described_class.new({ 'parent' => { 'id' => 2 } }).parent_id).to eq(2) }
|
2016-12-12 13:41:55 -05:00
|
|
|
it { expect(described_class.new({}).parent_id).to be_nil }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#inline?' do
|
|
|
|
it { expect(described_class.new('inline' => {}).inline?).to be_truthy }
|
|
|
|
it { expect(described_class.new({}).inline?).to be_falsey }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#has_parent?' do
|
|
|
|
it { expect(described_class.new('parent' => {}).has_parent?).to be_truthy }
|
|
|
|
it { expect(described_class.new({}).has_parent?).to be_falsey }
|
|
|
|
end
|
|
|
|
end
|