summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-07-06 08:57:16 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-07-06 08:57:16 +0000
commit5f52d6a038dc64db42d137aa83b3c104766c7098 (patch)
treedf23ce89a60dd9e3d6cfdc750531a904ee19e672 /spec
parenta4c4e7a77e0e61506c15b1655fbeb0916fda7f1b (diff)
parentd4be82d1c938d7d7b3b68bd628f5a24c7664e281 (diff)
downloadgitlab-ce-5f52d6a038dc64db42d137aa83b3c104766c7098.tar.gz
Merge branch 'add-irker-options' into 'master'
Add Irker service configuration options ### What does this MR do? This MR makes a number of hard-coded Irker parameters configurable in the service settings: Irker server host, port, and default IRC URI. It also removes the "max recipient" limit since the recipient list is configurable only by the project owner, and it makes no sense to update the limit when it is implied in the recipient list already. ### Why was this MR needed? The existing service assumed that gitlab.com was running an Irker daemon on `localhost` when it was not. Using Irker on gitlab.com thus did not work at all. This MR allows users to provide their own Irker daemons. ### Are there points in the code the reviewer needs to double check? My main concern is whether allowing a user to specify the server/port combination would have security implications for a host. Given that HipChat and Slack allow users to do this, I didn't think this was doing anything novel. ### What are the relevant issue numbers? * Closes #1713 * Closes #1714 * Closes gitlab-com/support-forum#139 ### Screenshots ### Before ![image](https://gitlab.com/stanhu/gitlab-ce/uploads/2eb3eb815e249e9fb669fc97ecd4f3c8/image.png) ### After ![image](https://gitlab.com/gitlab-org/gitlab-ce/uploads/cceaba951c05bd3df2c842cc68046b87/image.png) See merge request !930
Diffstat (limited to 'spec')
-rw-r--r--spec/models/project_services/irker_service_spec.rb40
1 files changed, 8 insertions, 32 deletions
diff --git a/spec/models/project_services/irker_service_spec.rb b/spec/models/project_services/irker_service_spec.rb
index 37690434ec8..7d483a44c53 100644
--- a/spec/models/project_services/irker_service_spec.rb
+++ b/spec/models/project_services/irker_service_spec.rb
@@ -38,22 +38,6 @@ describe IrkerService do
let(:_recipients) { nil }
it { should validate_presence_of :recipients }
end
-
- context 'too many recipients' do
- let(:_recipients) { 'a b c d' }
- it 'should add an error if there is too many recipients' do
- subject.send :check_recipients_count
- expect(subject.errors).not_to be_blank
- end
- end
-
- context '3 recipients' do
- let(:_recipients) { 'a b c' }
- it 'should not add an error if there is 3 recipients' do
- subject.send :check_recipients_count
- expect(subject.errors).to be_blank
- end
- end
end
describe 'Execute' do
@@ -62,7 +46,7 @@ describe IrkerService do
let(:project) { create(:project) }
let(:sample_data) { Gitlab::PushDataBuilder.build_sample(project, user) }
- let(:recipients) { '#commits' }
+ let(:recipients) { '#commits irc://test.net/#test ftp://bad' }
let(:colorize_messages) { '1' }
before do
@@ -71,17 +55,12 @@ describe IrkerService do
project: project,
project_id: project.id,
service_hook: true,
- properties: {
- 'recipients' => recipients,
- 'colorize_messages' => colorize_messages
- }
- )
- irker.settings = {
- server_ip: 'localhost',
+ server_host: 'localhost',
server_port: 6659,
- max_channels: 3,
- default_irc_uri: 'irc://chat.freenode.net/'
- }
+ default_irc_uri: 'irc://chat.freenode.net/',
+ recipients: recipients,
+ colorize_messages: colorize_messages)
+
irker.valid?
@irker_server = TCPServer.new 'localhost', 6659
end
@@ -97,11 +76,8 @@ describe IrkerService do
conn.readlines.each do |line|
msg = JSON.load(line.chomp("\n"))
expect(msg.keys).to match_array(['to', 'privmsg'])
- if msg['to'].is_a?(String)
- expect(msg['to']).to eq 'irc://chat.freenode.net/#commits'
- else
- expect(msg['to']).to match_array(['irc://chat.freenode.net/#commits'])
- end
+ expect(msg['to']).to match_array(["irc://chat.freenode.net/#commits",
+ "irc://test.net/#test"])
end
conn.close
end