diff options
author | tiagonbotelho <tiagonbotelho@hotmail.com> | 2016-08-01 16:00:44 +0100 |
---|---|---|
committer | tiagonbotelho <tiagonbotelho@hotmail.com> | 2016-08-09 15:11:39 +0100 |
commit | 1d268a89deef10854193db48d65cf5d519a0363d (patch) | |
tree | 59765b4a2f83b453875fa7aefe9b7ab5c65e3c67 /spec/models/project_services | |
parent | 519275c1102ad8a1d56f5807de2d8a1ae4b21dc0 (diff) | |
download | gitlab-ce-1d268a89deef10854193db48d65cf5d519a0363d.tar.gz |
adds second batch of tests changed to active tenseactive-tense-test-coverage
Diffstat (limited to 'spec/models/project_services')
13 files changed, 49 insertions, 48 deletions
diff --git a/spec/models/project_services/asana_service_spec.rb b/spec/models/project_services/asana_service_spec.rb index f3d15f3c1ea..dc702cfc42c 100644 --- a/spec/models/project_services/asana_service_spec.rb +++ b/spec/models/project_services/asana_service_spec.rb @@ -65,7 +65,7 @@ describe AsanaService, models: true do ) end - it 'should call Asana service to create a story' do + it 'calls Asana service to create a story' do data = create_data_for_commits('Message from commit. related to #123456') expected_message = "#{data[:user_name]} pushed to branch #{data[:ref]} of #{project.name_with_namespace} ( #{data[:commits][0][:url]} ): #{data[:commits][0][:message]}" @@ -76,7 +76,7 @@ describe AsanaService, models: true do @asana.execute(data) end - it 'should call Asana service to create a story and close a task' do + it 'calls Asana service to create a story and close a task' do data = create_data_for_commits('fix #456789') d1 = double('Asana::Task') expect(d1).to receive(:add_comment) @@ -86,7 +86,7 @@ describe AsanaService, models: true do @asana.execute(data) end - it 'should be able to close via url' do + 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') expect(d1).to receive(:add_comment) @@ -96,7 +96,7 @@ describe AsanaService, models: true do @asana.execute(data) end - it 'should allow multiple matches per line' do + it 'allows multiple matches per line' do message = <<-EOF minor bigfix, refactoring, fixed #123 and Closes #456 work on #789 ref https://app.asana.com/19292/956299/42 and closing https://app.asana.com/19292/956299/12 diff --git a/spec/models/project_services/assembla_service_spec.rb b/spec/models/project_services/assembla_service_spec.rb index 17e9361dd5c..00c4e0fb64c 100644 --- a/spec/models/project_services/assembla_service_spec.rb +++ b/spec/models/project_services/assembla_service_spec.rb @@ -44,7 +44,7 @@ describe AssemblaService, models: true do WebMock.stub_request(:post, @api_url) end - it "should call Assembla API" do + it "calls Assembla API" do @assembla_service.execute(@sample_data) expect(WebMock).to have_requested(:post, @api_url).with( body: /#{@sample_data[:before]}.*#{@sample_data[:after]}.*#{project.path}/ diff --git a/spec/models/project_services/external_wiki_service_spec.rb b/spec/models/project_services/external_wiki_service_spec.rb index 5fe5ea7d2df..d7c5ea95d71 100644 --- a/spec/models/project_services/external_wiki_service_spec.rb +++ b/spec/models/project_services/external_wiki_service_spec.rb @@ -56,7 +56,7 @@ describe ExternalWikiService, models: true do @service.destroy! end - it 'should replace the wiki url' do + it 'replaces the wiki url' do wiki_path = get_project_wiki_path(project) expect(wiki_path).to match('https://gitlab.com') end diff --git a/spec/models/project_services/flowdock_service_spec.rb b/spec/models/project_services/flowdock_service_spec.rb index b7e627e6518..6518098ceea 100644 --- a/spec/models/project_services/flowdock_service_spec.rb +++ b/spec/models/project_services/flowdock_service_spec.rb @@ -57,7 +57,7 @@ describe FlowdockService, models: true do WebMock.stub_request(:post, @api_url) end - it "should call FlowDock API" do + it "calls FlowDock API" do @flowdock_service.execute(@sample_data) @sample_data[:commits].each do |commit| # One request to Flowdock per new commit diff --git a/spec/models/project_services/gemnasium_service_spec.rb b/spec/models/project_services/gemnasium_service_spec.rb index a08f1ac229f..2c5583bdaa2 100644 --- a/spec/models/project_services/gemnasium_service_spec.rb +++ b/spec/models/project_services/gemnasium_service_spec.rb @@ -57,7 +57,7 @@ describe GemnasiumService, models: true do ) @sample_data = Gitlab::PushDataBuilder.build_sample(project, user) end - it "should call Gemnasium service" do + it "calls Gemnasium service" do expect(Gemnasium::GitlabService).to receive(:execute).with(an_instance_of(Hash)).once @gemnasium_service.execute(@sample_data) end diff --git a/spec/models/project_services/gitlab_issue_tracker_service_spec.rb b/spec/models/project_services/gitlab_issue_tracker_service_spec.rb index 7a1f106d6e3..8ef79a17d50 100644 --- a/spec/models/project_services/gitlab_issue_tracker_service_spec.rb +++ b/spec/models/project_services/gitlab_issue_tracker_service_spec.rb @@ -54,7 +54,7 @@ describe GitlabIssueTrackerService, models: true do @service.destroy! end - it 'should give the correct path' do + it 'gives the correct path' do expect(@service.project_url).to eq("http://localhost/gitlab/root/#{project.path_with_namespace}/issues") expect(@service.new_issue_url).to eq("http://localhost/gitlab/root/#{project.path_with_namespace}/issues/new") expect(@service.issue_url(432)).to eq("http://localhost/gitlab/root/#{project.path_with_namespace}/issues/432") @@ -71,7 +71,7 @@ describe GitlabIssueTrackerService, models: true do @service.destroy! end - it 'should give the correct path' do + it 'gives the correct path' do expect(@service.project_path).to eq("/gitlab/root/#{project.path_with_namespace}/issues") expect(@service.new_issue_path).to eq("/gitlab/root/#{project.path_with_namespace}/issues/new") expect(@service.issue_path(432)).to eq("/gitlab/root/#{project.path_with_namespace}/issues/432") diff --git a/spec/models/project_services/hipchat_service_spec.rb b/spec/models/project_services/hipchat_service_spec.rb index 62ae5f6cf74..bf438b26690 100644 --- a/spec/models/project_services/hipchat_service_spec.rb +++ b/spec/models/project_services/hipchat_service_spec.rb @@ -61,7 +61,7 @@ describe HipchatService, models: true do WebMock.stub_request(:post, api_url) end - it 'should test and return errors' do + it 'tests and return errors' do allow(hipchat).to receive(:execute).and_raise(StandardError, 'no such room') result = hipchat.test(push_sample_data) @@ -69,7 +69,7 @@ describe HipchatService, models: true do expect(result[:result].to_s).to eq('no such room') end - it 'should use v1 if version is provided' do + it 'uses v1 if version is provided' do allow(hipchat).to receive(:api_version).and_return('v1') expect(HipChat::Client).to receive(:new).with( token, @@ -79,7 +79,7 @@ describe HipchatService, models: true do hipchat.execute(push_sample_data) end - it 'should use v2 as the version when nothing is provided' do + it 'uses v2 as the version when nothing is provided' do allow(hipchat).to receive(:api_version).and_return('') expect(HipChat::Client).to receive(:new).with( token, @@ -90,13 +90,13 @@ describe HipchatService, models: true do end context 'push events' do - it "should call Hipchat API for push events" do + it "calls Hipchat API for push events" do hipchat.execute(push_sample_data) expect(WebMock).to have_requested(:post, api_url).once end - it "should create a push message" do + it "creates a push message" do message = hipchat.send(:create_push_message, push_sample_data) push_sample_data[:object_attributes] @@ -110,13 +110,13 @@ describe HipchatService, models: true do context 'tag_push events' do let(:push_sample_data) { Gitlab::PushDataBuilder.build(project, user, Gitlab::Git::BLANK_SHA, '1' * 40, 'refs/tags/test', []) } - it "should call Hipchat API for tag push events" do + it "calls Hipchat API for tag push events" do hipchat.execute(push_sample_data) expect(WebMock).to have_requested(:post, api_url).once end - it "should create a tag push message" do + it "creates a tag push message" do message = hipchat.send(:create_push_message, push_sample_data) push_sample_data[:object_attributes] @@ -131,13 +131,13 @@ describe HipchatService, models: true do let(:issue_service) { Issues::CreateService.new(project, user) } let(:issues_sample_data) { issue_service.hook_data(issue, 'open') } - it "should call Hipchat API for issue events" do + it "calls Hipchat API for issue events" do hipchat.execute(issues_sample_data) expect(WebMock).to have_requested(:post, api_url).once end - it "should create an issue message" do + it "creates an issue message" do message = hipchat.send(:create_issue_message, issues_sample_data) obj_attr = issues_sample_data[:object_attributes] @@ -154,13 +154,13 @@ describe HipchatService, models: true do let(:merge_service) { MergeRequests::CreateService.new(project, user) } let(:merge_sample_data) { merge_service.hook_data(merge_request, 'open') } - it "should call Hipchat API for merge requests events" do + it "calls Hipchat API for merge requests events" do hipchat.execute(merge_sample_data) expect(WebMock).to have_requested(:post, api_url).once end - it "should create a merge request message" do + it "creates a merge request message" do message = hipchat.send(:create_merge_request_message, merge_sample_data) @@ -184,7 +184,7 @@ describe HipchatService, models: true do note: 'a comment on a commit') end - it "should call Hipchat API for commit comment events" do + it "calls Hipchat API for commit comment events" do data = Gitlab::NoteDataBuilder.build(commit_note, user) hipchat.execute(data) @@ -216,7 +216,7 @@ describe HipchatService, models: true do note: "merge request note") end - it "should call Hipchat API for merge request comment events" do + it "calls Hipchat API for merge request comment events" do data = Gitlab::NoteDataBuilder.build(merge_request_note, user) hipchat.execute(data) @@ -243,7 +243,7 @@ describe HipchatService, models: true do note: "issue note") end - it "should call Hipchat API for issue comment events" do + it "calls Hipchat API for issue comment events" do data = Gitlab::NoteDataBuilder.build(issue_note, user) hipchat.execute(data) @@ -269,7 +269,7 @@ describe HipchatService, models: true do note: "snippet note") end - it "should call Hipchat API for snippet comment events" do + it "calls Hipchat API for snippet comment events" do data = Gitlab::NoteDataBuilder.build(snippet_note, user) hipchat.execute(data) @@ -297,13 +297,13 @@ describe HipchatService, models: true do context 'for failed' do before { build.drop } - it "should call Hipchat API" do + it "calls Hipchat API" do hipchat.execute(data) expect(WebMock).to have_requested(:post, api_url).once end - it "should create a build message" do + it "creates a build message" do message = hipchat.send(:create_build_message, data) project_url = project.web_url @@ -325,13 +325,13 @@ describe HipchatService, models: true do build.success end - it "should call Hipchat API" do + it "calls Hipchat API" do hipchat.notify_only_broken_builds = false hipchat.execute(data) expect(WebMock).to have_requested(:post, api_url).once end - it "should notify only broken" do + it "notifies only broken" do hipchat.notify_only_broken_builds = true hipchat.execute(data) expect(WebMock).not_to have_requested(:post, api_url).once diff --git a/spec/models/project_services/irker_service_spec.rb b/spec/models/project_services/irker_service_spec.rb index 4ee022a5171..b528baaf15c 100644 --- a/spec/models/project_services/irker_service_spec.rb +++ b/spec/models/project_services/irker_service_spec.rb @@ -71,7 +71,7 @@ describe IrkerService, models: true do @irker_server.close end - it 'should send valid JSON messages to an Irker listener' do + it 'sends valid JSON messages to an Irker listener' do irker.execute(sample_data) conn = @irker_server.accept diff --git a/spec/models/project_services/jira_service_spec.rb b/spec/models/project_services/jira_service_spec.rb index 5a97cf370da..342403f6354 100644 --- a/spec/models/project_services/jira_service_spec.rb +++ b/spec/models/project_services/jira_service_spec.rb @@ -75,7 +75,7 @@ describe JiraService, models: true do WebMock.stub_request(:post, @comment_url) end - it "should call JIRA API" do + it "calls JIRA API" do @jira_service.execute(merge_request, ExternalIssue.new("JIRA-123", project)) expect(WebMock).to have_requested(:post, @comment_url).with( @@ -128,7 +128,7 @@ describe JiraService, models: true do expect(@jira_service.api_url).to eq("http://jira_edited.example.com/rest/api/2") end - it "should reset password if url changed, even if setter called multiple times" do + it "resets password if url changed, even if setter called multiple times" do @jira_service.api_url = 'http://jira1.example.com/rest/api/2' @jira_service.api_url = 'http://jira1.example.com/rest/api/2' @jira_service.save @@ -181,7 +181,7 @@ describe JiraService, models: true do @service.destroy! end - it 'should be initialized' do + it 'is initialized' do expect(@service.title).to eq('JIRA') expect(@service.description).to eq("Jira issue tracker") end @@ -197,7 +197,7 @@ describe JiraService, models: true do @service.destroy! end - it "should be correct" do + it "is correct" do expect(@service.title).to eq('Jira One') expect(@service.description).to eq('Jira One issue tracker') end @@ -225,7 +225,7 @@ describe JiraService, models: true do @service.destroy! end - it 'should be prepopulated with the settings' do + it 'is prepopulated with the settings' do expect(@service.properties["project_url"]).to eq('http://jira.sample/projects/project_a') expect(@service.properties["issues_url"]).to eq("http://jira.sample/issues/:id") expect(@service.properties["new_issue_url"]).to eq("http://jira.sample/projects/project_a/issues/new") diff --git a/spec/models/project_services/pushover_service_spec.rb b/spec/models/project_services/pushover_service_spec.rb index 555d9757b47..19c0270a493 100644 --- a/spec/models/project_services/pushover_service_spec.rb +++ b/spec/models/project_services/pushover_service_spec.rb @@ -72,7 +72,7 @@ describe PushoverService, models: true do WebMock.stub_request(:post, api_url) end - it 'should call Pushover API' do + it 'calls Pushover API' do pushover.execute(sample_data) expect(WebMock).to have_requested(:post, api_url).once diff --git a/spec/models/project_services/slack_service/note_message_spec.rb b/spec/models/project_services/slack_service/note_message_spec.rb index 379c3e1219c..41b93f08050 100644 --- a/spec/models/project_services/slack_service/note_message_spec.rb +++ b/spec/models/project_services/slack_service/note_message_spec.rb @@ -60,6 +60,7 @@ describe SlackService::NoteMessage, models: true do title: "merge request title\ndetails\n" } end + it 'returns a message regarding notes on a merge request' do message = SlackService::NoteMessage.new(@args) expect(message.pretext).to eq("Test User commented on " \ diff --git a/spec/models/project_services/slack_service/wiki_page_message_spec.rb b/spec/models/project_services/slack_service/wiki_page_message_spec.rb index 46dedb66c7c..13aea0b0600 100644 --- a/spec/models/project_services/slack_service/wiki_page_message_spec.rb +++ b/spec/models/project_services/slack_service/wiki_page_message_spec.rb @@ -47,7 +47,7 @@ describe SlackService::WikiPageMessage, models: true do context 'when :action == "create"' do before { args[:object_attributes][:action] = 'create' } - it 'it returns the attachment for a new wiki page' do + it 'returns the attachment for a new wiki page' do expect(subject.attachments).to eq([ { text: "Wiki page description", @@ -60,7 +60,7 @@ describe SlackService::WikiPageMessage, models: true do context 'when :action == "update"' do before { args[:object_attributes][:action] = 'update' } - it 'it returns the attachment for an updated wiki page' do + it 'returns the attachment for an updated wiki page' do expect(subject.attachments).to eq([ { text: "Wiki page description", diff --git a/spec/models/project_services/slack_service_spec.rb b/spec/models/project_services/slack_service_spec.rb index df511b1bc4c..45a5f4ef12a 100644 --- a/spec/models/project_services/slack_service_spec.rb +++ b/spec/models/project_services/slack_service_spec.rb @@ -93,31 +93,31 @@ describe SlackService, models: true do @wiki_page_sample_data = wiki_page_service.hook_data(@wiki_page, 'create') end - it "should call Slack API for push events" do + it "calls Slack API for push events" do slack.execute(push_sample_data) expect(WebMock).to have_requested(:post, webhook_url).once end - it "should call Slack API for issue events" do + it "calls Slack API for issue events" do slack.execute(@issues_sample_data) expect(WebMock).to have_requested(:post, webhook_url).once end - it "should call Slack API for merge requests events" do + it "calls Slack API for merge requests events" do slack.execute(@merge_sample_data) expect(WebMock).to have_requested(:post, webhook_url).once end - it "should call Slack API for wiki page events" do + it "calls Slack API for wiki page events" do slack.execute(@wiki_page_sample_data) expect(WebMock).to have_requested(:post, webhook_url).once end - it 'should use the username as an option for slack when configured' do + it 'uses the username as an option for slack when configured' do allow(slack).to receive(:username).and_return(username) expect(Slack::Notifier).to receive(:new). with(webhook_url, username: username). @@ -128,7 +128,7 @@ describe SlackService, models: true do slack.execute(push_sample_data) end - it 'should use the channel as an option when it is configured' do + it 'uses the channel as an option when it is configured' do allow(slack).to receive(:channel).and_return(channel) expect(Slack::Notifier).to receive(:new). with(webhook_url, channel: channel). @@ -234,7 +234,7 @@ describe SlackService, models: true do note: 'a comment on a commit') end - it "should call Slack API for commit comment events" do + it "calls Slack API for commit comment events" do data = Gitlab::NoteDataBuilder.build(commit_note, user) slack.execute(data) @@ -248,7 +248,7 @@ describe SlackService, models: true do note: "merge request note") end - it "should call Slack API for merge request comment events" do + it "calls Slack API for merge request comment events" do data = Gitlab::NoteDataBuilder.build(merge_request_note, user) slack.execute(data) @@ -261,7 +261,7 @@ describe SlackService, models: true do create(:note_on_issue, project: project, note: "issue note") end - it "should call Slack API for issue comment events" do + it "calls Slack API for issue comment events" do data = Gitlab::NoteDataBuilder.build(issue_note, user) slack.execute(data) @@ -275,7 +275,7 @@ describe SlackService, models: true do note: "snippet note") end - it "should call Slack API for snippet comment events" do + it "calls Slack API for snippet comment events" do data = Gitlab::NoteDataBuilder.build(snippet_note, user) slack.execute(data) |