summaryrefslogtreecommitdiff
path: root/spec/models/project_services/asana_service_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-12 18:07:34 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-12 18:07:34 +0000
commit90859e80ca23b8709d56b60d2066b569053e7e02 (patch)
tree15d9ac5c194220fab358c42325645fdf2c6ead13 /spec/models/project_services/asana_service_spec.rb
parent7530cf5ad8dd86fbe19e129b6bb31b23849ed757 (diff)
downloadgitlab-ce-90859e80ca23b8709d56b60d2066b569053e7e02.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/project_services/asana_service_spec.rb')
-rw-r--r--spec/models/project_services/asana_service_spec.rb35
1 files changed, 18 insertions, 17 deletions
diff --git a/spec/models/project_services/asana_service_spec.rb b/spec/models/project_services/asana_service_spec.rb
index 18e839bcc64..8b6f2888c0a 100644
--- a/spec/models/project_services/asana_service_spec.rb
+++ b/spec/models/project_services/asana_service_spec.rb
@@ -21,6 +21,7 @@ describe AsanaService do
describe 'Execute' do
let(:user) { create(:user) }
let(:project) { create(:project) }
+ let(:gid) { "123456789ABCD" }
def create_data_for_commits(*messages)
{
@@ -48,32 +49,32 @@ describe AsanaService do
end
it 'calls Asana service to create a story' do
- data = create_data_for_commits('Message from commit. related to #123456')
+ data = create_data_for_commits("Message from commit. related to ##{gid}")
expected_message = "#{data[:user_name]} pushed to branch #{data[:ref]} of #{project.full_name} ( #{data[:commits][0][:url]} ): #{data[:commits][0][:message]}"
- d1 = double('Asana::Task')
+ d1 = double('Asana::Resources::Task')
expect(d1).to receive(:add_comment).with(text: expected_message)
- expect(Asana::Task).to receive(:find_by_id).with(anything, '123456').once.and_return(d1)
+ expect(Asana::Resources::Task).to receive(:find_by_id).with(anything, gid).once.and_return(d1)
@asana.execute(data)
end
it 'calls Asana service to create a story and close a task' do
data = create_data_for_commits('fix #456789')
- d1 = double('Asana::Task')
+ d1 = double('Asana::Resources::Task')
expect(d1).to receive(:add_comment)
expect(d1).to receive(:update).with(completed: true)
- expect(Asana::Task).to receive(:find_by_id).with(anything, '456789').once.and_return(d1)
+ expect(Asana::Resources::Task).to receive(:find_by_id).with(anything, '456789').once.and_return(d1)
@asana.execute(data)
end
it 'is able to close via url' do
data = create_data_for_commits('closes https://app.asana.com/19292/956299/42')
- d1 = double('Asana::Task')
+ d1 = double('Asana::Resources::Task')
expect(d1).to receive(:add_comment)
expect(d1).to receive(:update).with(completed: true)
- expect(Asana::Task).to receive(:find_by_id).with(anything, '42').once.and_return(d1)
+ expect(Asana::Resources::Task).to receive(:find_by_id).with(anything, '42').once.and_return(d1)
@asana.execute(data)
end
@@ -84,28 +85,28 @@ describe AsanaService do
ref https://app.asana.com/19292/956299/42 and closing https://app.asana.com/19292/956299/12
EOF
data = create_data_for_commits(message)
- d1 = double('Asana::Task')
+ d1 = double('Asana::Resources::Task')
expect(d1).to receive(:add_comment)
expect(d1).to receive(:update).with(completed: true)
- expect(Asana::Task).to receive(:find_by_id).with(anything, '123').once.and_return(d1)
+ expect(Asana::Resources::Task).to receive(:find_by_id).with(anything, '123').once.and_return(d1)
- d2 = double('Asana::Task')
+ d2 = double('Asana::Resources::Task')
expect(d2).to receive(:add_comment)
expect(d2).to receive(:update).with(completed: true)
- expect(Asana::Task).to receive(:find_by_id).with(anything, '456').once.and_return(d2)
+ expect(Asana::Resources::Task).to receive(:find_by_id).with(anything, '456').once.and_return(d2)
- d3 = double('Asana::Task')
+ d3 = double('Asana::Resources::Task')
expect(d3).to receive(:add_comment)
- expect(Asana::Task).to receive(:find_by_id).with(anything, '789').once.and_return(d3)
+ expect(Asana::Resources::Task).to receive(:find_by_id).with(anything, '789').once.and_return(d3)
- d4 = double('Asana::Task')
+ d4 = double('Asana::Resources::Task')
expect(d4).to receive(:add_comment)
- expect(Asana::Task).to receive(:find_by_id).with(anything, '42').once.and_return(d4)
+ expect(Asana::Resources::Task).to receive(:find_by_id).with(anything, '42').once.and_return(d4)
- d5 = double('Asana::Task')
+ d5 = double('Asana::Resources::Task')
expect(d5).to receive(:add_comment)
expect(d5).to receive(:update).with(completed: true)
- expect(Asana::Task).to receive(:find_by_id).with(anything, '12').once.and_return(d5)
+ expect(Asana::Resources::Task).to receive(:find_by_id).with(anything, '12').once.and_return(d5)
@asana.execute(data)
end