diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-28 00:09:08 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-28 00:09:08 +0000 |
commit | f54a50aa826d0eedcf2e56f51462613bc132f826 (patch) | |
tree | 7194aca23f9af822ea55966a6f477b3d8d68ee47 /spec/models | |
parent | c77fda905a8619b756163c10a75171dc9cfe7084 (diff) | |
download | gitlab-ce-f54a50aa826d0eedcf2e56f51462613bc132f826.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/milestone_spec.rb | 22 | ||||
-rw-r--r-- | spec/models/snippet_spec.rb | 7 |
2 files changed, 26 insertions, 3 deletions
diff --git a/spec/models/milestone_spec.rb b/spec/models/milestone_spec.rb index 04587ef4240..de79156562d 100644 --- a/spec/models/milestone_spec.rb +++ b/spec/models/milestone_spec.rb @@ -3,6 +3,18 @@ require 'spec_helper' describe Milestone do + describe 'MilestoneStruct#serializable_hash' do + let(:predefined_milestone) { described_class::MilestoneStruct.new('Test Milestone', '#test', 1) } + + it 'presents the predefined milestone as a hash' do + expect(predefined_milestone.serializable_hash).to eq( + title: predefined_milestone.title, + name: predefined_milestone.name, + id: predefined_milestone.id + ) + end + end + describe 'modules' do context 'with a project' do it_behaves_like 'AtomicInternalId' do @@ -179,6 +191,16 @@ describe Milestone do end end + describe '.predefined_id?' do + it 'returns true for a predefined Milestone ID' do + expect(Milestone.predefined_id?(described_class::Upcoming.id)).to be true + end + + it 'returns false for a Milestone ID that is not predefined' do + expect(Milestone.predefined_id?(milestone.id)).to be false + end + end + describe '.order_by_name_asc' do it 'sorts by name ascending' do milestone1 = create(:milestone, title: 'Foo') diff --git a/spec/models/snippet_spec.rb b/spec/models/snippet_spec.rb index 93bc42c144d..1265b95736d 100644 --- a/spec/models/snippet_spec.rb +++ b/spec/models/snippet_spec.rb @@ -536,7 +536,7 @@ describe Snippet do end describe '#track_snippet_repository' do - let(:snippet) { create(:snippet, :repository) } + let(:snippet) { create(:snippet) } context 'when a snippet repository entry does not exist' do it 'creates a new entry' do @@ -554,7 +554,8 @@ describe Snippet do end context 'when a tracking entry exists' do - let!(:snippet_repository) { create(:snippet_repository, snippet: snippet) } + let!(:snippet) { create(:snippet, :repository) } + let(:snippet_repository) { snippet.snippet_repository } let!(:shard) { create(:shard, name: 'foo') } it 'does not create a new entry in the database' do @@ -592,7 +593,7 @@ describe Snippet do end context 'when repository exists' do - let(:snippet) { create(:snippet, :repository) } + let!(:snippet) { create(:snippet, :repository) } it 'does not try to create repository' do expect(snippet.repository).not_to receive(:after_create) |