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

comment_spec.rb « representation « bitbucket_server « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a989338a317c5ab54740765f95de15b8f56cf362 (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
29
30
31
32
33
34
35
36
37
38
require 'spec_helper'

describe BitbucketServer::Representation::Comment do
  let(:activities) { JSON.parse(fixture_file('importers/bitbucket_server/activities.json'))['values'] }
  let(:comment) { activities.first }

  subject { described_class.new(comment) }

  describe '#id' do
    it { expect(subject.id).to eq(9) }
  end

  describe '#author_username' do
    it { expect(subject.author_username).to eq('root' ) }
  end

  describe '#author_email' do
    it { expect(subject.author_email).to eq('test.user@example.com' ) }
  end

  describe '#note' do
    it { expect(subject.note).to eq('is this a new line?') }
  end

  describe '#created_at' do
    it { expect(subject.created_at).to be_a(Time) }
  end

  describe '#updated_at' do
    it { expect(subject.created_at).to be_a(Time) }
  end

  describe '#comments' do
    it { expect(subject.comments.count).to eq(4) }
    it { expect(subject.comments).to all( be_a(described_class) ) }
    it { expect(subject.comments.map(&:note)).to match_array(["Hello world", "Ok", "hello", "hi"]) }
  end
end