ichverstehe-integrity-irc 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/test/irc_test.rb +33 -0
- metadata +5 -6
- data/spec/irc_spec.rb +0 -72
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: ichverstehe-integrity-irc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Rozet
|
@@ -9,11 +9,11 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-03-
|
12
|
+
date: 2009-03-04 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
16
|
+
name: integrity
|
17
17
|
type: :runtime
|
18
18
|
version_requirement:
|
19
19
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -23,7 +23,7 @@ dependencies:
|
|
23
23
|
version: "0"
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
26
|
+
name: shout-bot
|
27
27
|
type: :runtime
|
28
28
|
version_requirement:
|
29
29
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,6 @@ extra_rdoc_files: []
|
|
42
42
|
|
43
43
|
files:
|
44
44
|
- README.markdown
|
45
|
-
- lib/notifier/config.haml
|
46
45
|
- lib/notifier/irc.rb
|
47
46
|
has_rdoc: false
|
48
47
|
homepage: http://integrityapp.com
|
@@ -71,4 +70,4 @@ signing_key:
|
|
71
70
|
specification_version: 2
|
72
71
|
summary: IRC notifier for the Integrity continuous integration server
|
73
72
|
test_files:
|
74
|
-
-
|
73
|
+
- test/irc_test.rb
|
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
|