File: pull_request_comment_spec.rb

package info (click to toggle)
gitlab 17.6.5-19
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 629,368 kB
  • sloc: ruby: 1,915,304; javascript: 557,307; sql: 60,639; xml: 6,509; sh: 4,567; makefile: 1,239; python: 406
file content (42 lines) | stat: -rw-r--r-- 1,413 bytes parent folder | download
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# frozen_string_literal: true

require 'fast_spec_helper'

RSpec.describe Bitbucket::Representation::PullRequestComment, feature_category: :importers do
  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
    it { expect(described_class.new({ 'parent' => { 'id' => 2 } }).parent_id).to eq(2) }
    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

  describe '#deleted?' do
    it { expect(described_class.new('deleted' => true).deleted?).to be_truthy }
    it { expect(described_class.new('deleted' => false).deleted?).to be_falsey }
    it { expect(described_class.new({}).deleted?).to be_falsey }
  end
end