diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-04-21 12:25:21 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-04-22 08:00:57 +0200 |
commit | 8df63d1513118f0b3643365e2950a68c80e46176 (patch) | |
tree | 35bdb2a4d38da94ae67021b6b5a37eaf4de47f55 | |
parent | 4adfd501a5d31abd16bccf08586bf8a125b03450 (diff) | |
download | gitlab-ce-8df63d1513118f0b3643365e2950a68c80e46176.tar.gz |
Update specs to accomodate issuable assign changes
-rw-r--r-- | spec/services/issues/bulk_update_service_spec.rb | 2 | ||||
-rw-r--r-- | spec/services/issues/create_service_spec.rb | 28 | ||||
-rw-r--r-- | spec/services/issues/update_service_spec.rb | 11 | ||||
-rw-r--r-- | spec/services/merge_requests/update_service_spec.rb | 11 |
4 files changed, 31 insertions, 21 deletions
diff --git a/spec/services/issues/bulk_update_service_spec.rb b/spec/services/issues/bulk_update_service_spec.rb index 6a7ea4b2f44..e91906d0d49 100644 --- a/spec/services/issues/bulk_update_service_spec.rb +++ b/spec/services/issues/bulk_update_service_spec.rb @@ -100,7 +100,7 @@ describe Issues::BulkUpdateService, services: true do describe :update_milestone do before do - @milestone = create :milestone + @milestone = create(:milestone, project: @project) @params = { issues_ids: [issue.id], milestone_id: @milestone.id diff --git a/spec/services/issues/create_service_spec.rb b/spec/services/issues/create_service_spec.rb index d11c45df8ff..64921c5f473 100644 --- a/spec/services/issues/create_service_spec.rb +++ b/spec/services/issues/create_service_spec.rb @@ -6,31 +6,31 @@ describe Issues::CreateService, services: true do let(:assignee) { create(:user) } describe :execute do + let(:issue) { Issues::CreateService.new(project, user, opts).execute } + context 'valid params' do before do project.team << [user, :master] project.team << [assignee, :master] + end - opts = { - title: 'Awesome issue', + let(:opts) do + { title: 'Awesome issue', description: 'please fix', - assignee: assignee - } - - @issue = Issues::CreateService.new(project, user, opts).execute + assignee: assignee } end - it { expect(@issue).to be_valid } - it { expect(@issue.title).to eq('Awesome issue') } - it { expect(@issue.assignee).to eq assignee } + it { expect(issue).to be_valid } + it { expect(issue.title).to eq('Awesome issue') } + it { expect(issue.assignee).to eq assignee } it 'creates a pending todo for new assignee' do attributes = { project: project, author: user, user: assignee, - target_id: @issue.id, - target_type: @issue.class.name, + target_id: issue.id, + target_type: issue.class.name, action: Todo::ASSIGNED, state: :pending } @@ -39,8 +39,8 @@ describe Issues::CreateService, services: true do end context 'label that belongs to different project' do - let(:issue) { Issues::CreateService.new(project, user, opts).execute } let(:label) { create(:label) } + let(:opts) do { title: 'Title', description: 'Description', @@ -53,15 +53,15 @@ describe Issues::CreateService, services: true do end context 'milestone that belongs to different project' do - let(:issue) { Issues::CreateService.new(project, user, opts).execute } let(:milestone) { create(:milestone) } + let(:opts) do { title: 'Title', description: 'Description', milestone_id: milestone.id } end - it 'does not assign label' do + it 'does not assign milestone' do expect(issue.milestone).to_not eq milestone end end diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb index 6b214a0d96b..52f69306994 100644 --- a/spec/services/issues/update_service_spec.rb +++ b/spec/services/issues/update_service_spec.rb @@ -4,10 +4,15 @@ describe Issues::UpdateService, services: true do let(:user) { create(:user) } let(:user2) { create(:user) } let(:user3) { create(:user) } - let(:issue) { create(:issue, title: 'Old title', assignee_id: user3.id) } - let(:label) { create(:label) } + let(:project) { create(:empty_project) } + let(:label) { create(:label, project: project) } let(:label2) { create(:label) } - let(:project) { issue.project } + + let(:issue) do + create(:issue, title: 'Old title', + assignee_id: user3.id, + project: project) + end before do project.team << [user, :master] diff --git a/spec/services/merge_requests/update_service_spec.rb b/spec/services/merge_requests/update_service_spec.rb index cb8cff2fa8c..213e8c2eb3a 100644 --- a/spec/services/merge_requests/update_service_spec.rb +++ b/spec/services/merge_requests/update_service_spec.rb @@ -1,14 +1,19 @@ require 'spec_helper' describe MergeRequests::UpdateService, services: true do + let(:project) { create(:project) } let(:user) { create(:user) } let(:user2) { create(:user) } let(:user3) { create(:user) } - let(:merge_request) { create(:merge_request, :simple, title: 'Old title', assignee_id: user3.id) } - let(:project) { merge_request.project } - let(:label) { create(:label) } + let(:label) { create(:label, project: project) } let(:label2) { create(:label) } + let(:merge_request) do + create(:merge_request, :simple, title: 'Old title', + assignee_id: user3.id, + source_project: project) + end + before do project.team << [user, :master] project.team << [user2, :developer] |