summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-05-10 23:52:46 -0400
committerRobert Speicher <rspeicher@gmail.com>2015-05-11 00:01:16 -0400
commit54db527b4c44b102b81f4614bee6b06d2b742f6a (patch)
treeffbd53b724c68c080247f863827ec28d281be4aa
parent3e8efce360e3dadac69554d0bdebdcfde918f6e7 (diff)
downloadgitlab-ce-rs-system-note.tar.gz
Reorganize SystemNoteService spec a bitrs-system-note
-rw-r--r--spec/services/system_note_service_spec.rb30
1 files changed, 17 insertions, 13 deletions
diff --git a/spec/services/system_note_service_spec.rb b/spec/services/system_note_service_spec.rb
index 6ddec8e67b1..4e4cb6d19ed 100644
--- a/spec/services/system_note_service_spec.rb
+++ b/spec/services/system_note_service_spec.rb
@@ -6,6 +6,10 @@ describe SystemNoteService do
let(:noteable) { create(:issue, project: project) }
shared_examples_for 'a system note' do
+ it 'is valid' do
+ expect(subject).to be_valid
+ end
+
it 'sets the noteable model' do
expect(subject.noteable).to eq noteable
end
@@ -24,13 +28,13 @@ describe SystemNoteService do
end
describe '.add_commits' do
+ subject { described_class.add_commits(noteable, project, author, new_commits, old_commits, oldrev) }
+
let(:noteable) { create(:merge_request, source_project: project) }
let(:new_commits) { noteable.commits }
let(:old_commits) { [] }
let(:oldrev) { nil }
- subject { described_class.add_commits(noteable, project, author, new_commits, old_commits, oldrev) }
-
it_behaves_like 'a system note'
describe 'note body' do
@@ -100,10 +104,10 @@ describe SystemNoteService do
end
describe '.change_assignee' do
- let(:assignee) { create(:user) }
-
subject { described_class.change_assignee(noteable, project, author, assignee) }
+ let(:assignee) { create(:user) }
+
it_behaves_like 'a system note'
context 'when assignee added' do
@@ -122,12 +126,12 @@ describe SystemNoteService do
end
describe '.change_label' do
+ subject { described_class.change_label(noteable, project, author, added, removed) }
+
let(:labels) { create_list(:label, 2) }
let(:added) { [] }
let(:removed) { [] }
- subject { described_class.change_label(noteable, project, author, added, removed) }
-
it_behaves_like 'a system note'
context 'with added labels' do
@@ -159,10 +163,10 @@ describe SystemNoteService do
end
describe '.change_milestone' do
- let(:milestone) { create(:milestone, project: project) }
-
subject { described_class.change_milestone(noteable, project, author, milestone) }
+ let(:milestone) { create(:milestone, project: project) }
+
it_behaves_like 'a system note'
context 'when milestone added' do
@@ -181,11 +185,11 @@ describe SystemNoteService do
end
describe '.change_status' do
+ subject { described_class.change_status(noteable, project, author, status, source) }
+
let(:status) { 'new_status' }
let(:source) { nil }
- subject { described_class.change_status(noteable, project, author, status, source) }
-
it_behaves_like 'a system note'
context 'with a source' do
@@ -204,10 +208,10 @@ describe SystemNoteService do
end
describe '.cross_reference' do
- let(:mentioner) { create(:issue, project: project) }
-
subject { described_class.cross_reference(noteable, mentioner, author) }
+ let(:mentioner) { create(:issue, project: project) }
+
it_behaves_like 'a system note'
context 'when cross-reference disallowed' do
@@ -245,7 +249,7 @@ describe SystemNoteService do
end
end
- context 'same project' do
+ context 'within the same project' do
context 'from Commit' do
let(:mentioner) { project.repository.commit }