sr-integrity-irc 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/notifier/irc.rb +7 -3
- data/test/irc_test.rb +33 -0
- metadata +6 -5
- data/lib/notifier/config.haml +0 -3
- data/spec/irc_spec.rb +0 -72
data/lib/notifier/irc.rb
CHANGED
@@ -8,7 +8,11 @@ module Integrity
|
|
8
8
|
attr_reader :uri
|
9
9
|
|
10
10
|
def self.to_haml
|
11
|
-
|
11
|
+
<<-HAML
|
12
|
+
%p.normal
|
13
|
+
%label{ :for => 'irc_notifier_uri' } Send to
|
14
|
+
%input.text#irc_notifier_uri{ :name => 'notifiers[IRC][uri]', :type => 'text', :value => config['uri'] || 'irc://IntegrityBot@irc.freenode.net:6667/#test' }
|
15
|
+
HAML
|
12
16
|
end
|
13
17
|
|
14
18
|
def initialize(build, config={})
|
@@ -17,9 +21,9 @@ module Integrity
|
|
17
21
|
end
|
18
22
|
|
19
23
|
def deliver!
|
20
|
-
ShoutBot.shout(uri
|
24
|
+
ShoutBot.shout(uri) do |channel|
|
21
25
|
channel.say "#{build.project.name}: #{short_message}"
|
22
|
-
channel.say
|
26
|
+
channel.say commit_url
|
23
27
|
end
|
24
28
|
end
|
25
29
|
end
|
data/test/irc_test.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require "test/unit"
|
2
|
+
require "rr"
|
3
|
+
require "integrity/notifier/test_helpers"
|
4
|
+
|
5
|
+
begin
|
6
|
+
require "redgreen"
|
7
|
+
rescue LoadError
|
8
|
+
end
|
9
|
+
|
10
|
+
require File.dirname(__FILE__) + "/../lib/notifier/irc"
|
11
|
+
|
12
|
+
class IRCTest < Test::Unit::TestCase
|
13
|
+
include RR::Adapters::TestUnit
|
14
|
+
include Integrity::Notifier::TestHelpers
|
15
|
+
|
16
|
+
def setup
|
17
|
+
setup_database
|
18
|
+
end
|
19
|
+
|
20
|
+
def notifier
|
21
|
+
"IRC"
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_configuration_form
|
25
|
+
assert_form_have_option "uri", "irc://irc.freenode.net/test"
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_send_notification
|
29
|
+
config = { "uri" => "irc://foo:bar@irc.freenode.net/test" }
|
30
|
+
stub(ShoutBot).shout("irc://foo:bar@irc.freenode.net/test") { nil }
|
31
|
+
Integrity::Notifier::IRC.new(commit, config).deliver!
|
32
|
+
end
|
33
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sr-integrity-irc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Rozet
|
@@ -9,11 +9,12 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-03-04 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: foca-integrity
|
17
|
+
type: :runtime
|
17
18
|
version_requirement:
|
18
19
|
version_requirements: !ruby/object:Gem::Requirement
|
19
20
|
requirements:
|
@@ -22,7 +23,8 @@ dependencies:
|
|
22
23
|
version: "0"
|
23
24
|
version:
|
24
25
|
- !ruby/object:Gem::Dependency
|
25
|
-
name:
|
26
|
+
name: ichverstehe-shout-bot
|
27
|
+
type: :runtime
|
26
28
|
version_requirement:
|
27
29
|
version_requirements: !ruby/object:Gem::Requirement
|
28
30
|
requirements:
|
@@ -40,7 +42,6 @@ extra_rdoc_files: []
|
|
40
42
|
|
41
43
|
files:
|
42
44
|
- README.markdown
|
43
|
-
- lib/notifier/config.haml
|
44
45
|
- lib/notifier/irc.rb
|
45
46
|
has_rdoc: false
|
46
47
|
homepage: http://integrityapp.com
|
@@ -69,4 +70,4 @@ signing_key:
|
|
69
70
|
specification_version: 2
|
70
71
|
summary: IRC notifier for the Integrity continuous integration server
|
71
72
|
test_files:
|
72
|
-
-
|
73
|
+
- test/irc_test.rb
|
data/lib/notifier/config.haml
DELETED
data/spec/irc_spec.rb
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/../lib/notifier/irc"
|
2
|
-
require Integrity.root / "spec" / "spec_helper"
|
3
|
-
|
4
|
-
describe Integrity::Notifier::IRC do
|
5
|
-
include AppSpecHelper
|
6
|
-
include NotifierSpecHelper
|
7
|
-
|
8
|
-
it_should_behave_like "A notifier"
|
9
|
-
|
10
|
-
def klass
|
11
|
-
Integrity::Notifier::IRC
|
12
|
-
end
|
13
|
-
|
14
|
-
def notifier_config(opts={})
|
15
|
-
{"uri" =>"irc://irc.freenode.net:6667/integrity"}
|
16
|
-
end
|
17
|
-
|
18
|
-
def notifier
|
19
|
-
@notifier ||= Integrity::Notifier::IRC.new(mock_build, notifier_config)
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should have an uri" do
|
23
|
-
notifier.uri.should == "irc://irc.freenode.net:6667/integrity"
|
24
|
-
end
|
25
|
-
|
26
|
-
describe "Generating a form for configuration" do
|
27
|
-
describe "with a field for the IRC URI" do
|
28
|
-
it "should have the proper name, id and label and a default value" do
|
29
|
-
the_form.should have_textfield("irc_notifier_uri").
|
30
|
-
named("notifiers[IRC][uri]").
|
31
|
-
with_label("Send to").
|
32
|
-
with_value("irc://irc.freenode.net:6667/test")
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should use the config's 'uri' value if available" do
|
36
|
-
the_form(:config => { "uri" => "irc://irc.freenode.net/integrity" }).
|
37
|
-
should have_textfield("irc_notifier_uri").
|
38
|
-
with_value("irc://irc.freenode.net/integrity")
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
describe "Delevering the build" do
|
44
|
-
def do_notify
|
45
|
-
notifier.deliver!
|
46
|
-
end
|
47
|
-
|
48
|
-
before do
|
49
|
-
@channel = mock("channel", :say => "")
|
50
|
-
ShoutBot.stub!(:shout).and_yield(@channel)
|
51
|
-
end
|
52
|
-
|
53
|
-
it "should connect to the given URI as IntegrityBot" do
|
54
|
-
ShoutBot.should_receive(:shout).
|
55
|
-
with(notifier_config["uri"], {:as => "IntegrityBot"})
|
56
|
-
do_notify
|
57
|
-
end
|
58
|
-
|
59
|
-
it "should give the build status and project name" do
|
60
|
-
notifier.build.project.should_receive(:name).and_return("Integrity")
|
61
|
-
notifier.should_receive(:short_message).and_return("short message")
|
62
|
-
@channel.should_receive(:say).with("Integrity: short message")
|
63
|
-
do_notify
|
64
|
-
end
|
65
|
-
|
66
|
-
it "should give the build url" do
|
67
|
-
notifier.should_receive(:build_url).and_return("http://example.org")
|
68
|
-
@channel.should_receive(:say).with("http://example.org")
|
69
|
-
do_notify
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|