summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2016-07-13 16:49:47 -0300
committerFelipe Artur <felipefac@gmail.com>2016-07-20 12:11:37 -0300
commit323d796a0e7b5f1ef5a170f9918897f6a2d4121e (patch)
tree73a2939ff4a647e00c251171f3c8094acba355e0 /spec
parentede048b930b2ceb89013793d878524eb20248d1f (diff)
downloadgitlab-ce-323d796a0e7b5f1ef5a170f9918897f6a2d4121e.tar.gz
Refactor service settings viewissue_8110
Diffstat (limited to 'spec')
-rw-r--r--spec/features/projects/slack_service/slack_service_spec.rb26
-rw-r--r--spec/models/project_services/slack_service_spec.rb10
2 files changed, 31 insertions, 5 deletions
diff --git a/spec/features/projects/slack_service/slack_service_spec.rb b/spec/features/projects/slack_service/slack_service_spec.rb
new file mode 100644
index 00000000000..16541f51d98
--- /dev/null
+++ b/spec/features/projects/slack_service/slack_service_spec.rb
@@ -0,0 +1,26 @@
+require 'spec_helper'
+
+feature 'Projects > Slack service > Setup events', feature: true do
+ let(:user) { create(:user) }
+ let(:service) { SlackService.new }
+ let(:project) { create(:project, slack_service: service) }
+
+ background do
+ service.fields
+ service.update_attributes(push_channel: 1, issue_channel: 2, merge_request_channel: 3, note_channel: 4, tag_push_channel: 5, build_channel: 6, wiki_page_channel: 7)
+ project.team << [user, :master]
+ login_as(user)
+ end
+
+ scenario 'user can filter events by channel' do
+ visit edit_namespace_project_service_path(project.namespace, project, service)
+
+ expect(page.find_field("service_push_channel").value).to have_content '1'
+ expect(page.find_field("service_issue_channel").value).to have_content '2'
+ expect(page.find_field("service_merge_request_channel").value).to have_content '3'
+ expect(page.find_field("service_note_channel").value).to have_content '4'
+ expect(page.find_field("service_tag_push_channel").value).to have_content '5'
+ expect(page.find_field("service_build_channel").value).to have_content '6'
+ expect(page.find_field("service_wiki_page_channel").value).to have_content '7'
+ end
+end
diff --git a/spec/models/project_services/slack_service_spec.rb b/spec/models/project_services/slack_service_spec.rb
index 1beb7c63b0b..df511b1bc4c 100644
--- a/spec/models/project_services/slack_service_spec.rb
+++ b/spec/models/project_services/slack_service_spec.rb
@@ -139,7 +139,7 @@ describe SlackService, models: true do
end
context "event channels" do
- it "should user the right channel for push event" do
+ it "uses the right channel for push event" do
slack.update_attributes(push_channel: "random")
expect(Slack::Notifier).to receive(:new).
@@ -151,7 +151,7 @@ describe SlackService, models: true do
slack.execute(push_sample_data)
end
- it "should use the right channel for merge request event" do
+ it "uses the right channel for merge request event" do
slack.update_attributes(merge_request_channel: "random")
expect(Slack::Notifier).to receive(:new).
@@ -163,7 +163,7 @@ describe SlackService, models: true do
slack.execute(@merge_sample_data)
end
- it "should use the right channel for issue event" do
+ it "uses the right channel for issue event" do
slack.update_attributes(issue_channel: "random")
expect(Slack::Notifier).to receive(:new).
@@ -175,7 +175,7 @@ describe SlackService, models: true do
slack.execute(@issues_sample_data)
end
- it "should use the right channel for wiki event" do
+ it "uses the right channel for wiki event" do
slack.update_attributes(wiki_page_channel: "random")
expect(Slack::Notifier).to receive(:new).
@@ -192,7 +192,7 @@ describe SlackService, models: true do
create(:note_on_issue, project: project, note: "issue note")
end
- it "should use the right channel" do
+ it "uses the right channel" do
slack.update_attributes(note_channel: "random")
note_data = Gitlab::NoteDataBuilder.build(issue_note, user)