rhomobile-cijoe 0.2.1

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.
@@ -0,0 +1,60 @@
1
+ require File.dirname(__FILE__) + '/../lib/cijoe'
2
+ require 'ostruct'
3
+
4
+ describe CIJoe::Email do
5
+
6
+ describe "activate" do
7
+ it "should include Email into the Build class if the config is valid" do
8
+ CIJoe::Config.stub!(:email => stub(:to => 'build@housetrip.com', :user => 'joe', :pass => 'passwd', :host => 'mail.example.com'))
9
+
10
+ CIJoe::Email.activate
11
+ CIJoe::Build.ancestors.should include(CIJoe::Email)
12
+ end
13
+
14
+ it "should not include Email into the Build class if the config is not valid" do
15
+ CIJoe::Email.activate
16
+ CIJoe::Build.ancestors.should_not include(CIJoe::Email)
17
+ end
18
+ end
19
+
20
+
21
+ describe "notify" do
22
+ class TestBuild
23
+ include CIJoe::Email
24
+
25
+ def initialize(worked)
26
+ @worked = worked
27
+ end
28
+
29
+ def worked?
30
+ @worked
31
+ end
32
+
33
+ def failed?
34
+ !@worked
35
+ end
36
+
37
+ def commit
38
+ OpenStruct.new(:url => "github.com/commit/bha75as")
39
+ end
40
+ end
41
+
42
+ CIJoe::Config.class_eval do
43
+ def self.email
44
+ OpenStruct.new(
45
+ :to => 'build@housetrip.com'
46
+ )
47
+ end
48
+ end
49
+
50
+ it "should send an email if the build failed" do
51
+ MmMail.should_receive(:send).with(:to => 'build@housetrip.com', :from => 'build@housetrip.com', :subject => 'Build failed', :body => 'The commit github.com/commit/bha75as caused the build to fail.')
52
+ TestBuild.new(false).notify
53
+ end
54
+
55
+ it "should send no email if the build succeeded" do
56
+ MmMail.should_not_receive(:send)
57
+ TestBuild.new(true).notify
58
+ end
59
+ end
60
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,9 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+
4
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ require 'cijoe'
7
+
8
+ class Test::Unit::TestCase
9
+ end
@@ -0,0 +1,17 @@
1
+ require 'helper'
2
+
3
+ class TestCIJoe < Test::Unit::TestCase
4
+ def test_raise_error_on_invalid_command
5
+ assert_raise RuntimeError, LoadError do
6
+ CIJoe::Config.new('--invalid').to_s
7
+ end
8
+ end
9
+
10
+ def test_return_value_of_config
11
+ assert_equal `git config blame`.chomp, CIJoe::Config.new('blame').to_s
12
+ end
13
+
14
+ def test_return_empty_string_when_config_does_not_exist
15
+ assert_equal '', CIJoe::Config.new('invalid').to_s
16
+ end
17
+ end
metadata ADDED
@@ -0,0 +1,137 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rhomobile-cijoe
3
+ version: !ruby/object:Gem::Version
4
+ hash: 21
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 2
9
+ - 1
10
+ version: 0.2.1
11
+ platform: ruby
12
+ authors:
13
+ - Chris Wanstrath
14
+ - Brian Moore
15
+ - Lars Burgess
16
+ autorequire:
17
+ bindir: bin
18
+ cert_chain: []
19
+
20
+ date: 2010-06-22 00:00:00 -07:00
21
+ default_executable: cijoe
22
+ dependencies:
23
+ - !ruby/object:Gem::Dependency
24
+ name: choice
25
+ prerelease: false
26
+ requirement: &id001 !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ hash: 3
32
+ segments:
33
+ - 0
34
+ version: "0"
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: sinatra
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
48
+ version: "0"
49
+ type: :runtime
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: systemu
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
63
+ type: :runtime
64
+ version_requirements: *id003
65
+ description: CI Joe is a simple Continuous Integration server.
66
+ email: dev@rhomobile.com
67
+ executables:
68
+ - cijoe
69
+ extensions: []
70
+
71
+ extra_rdoc_files:
72
+ - LICENSE
73
+ - README.markdown
74
+ files:
75
+ - .gitignore
76
+ - LICENSE
77
+ - README.markdown
78
+ - Rakefile
79
+ - VERSION
80
+ - bin/cijoe
81
+ - deps.rip
82
+ - examples/cijoe.ru
83
+ - examples/cijoed
84
+ - lib/cijoe.rb
85
+ - lib/cijoe/build.rb
86
+ - lib/cijoe/commit.rb
87
+ - lib/cijoe/config.rb
88
+ - lib/cijoe/email.rb
89
+ - lib/cijoe/public/favicon.ico
90
+ - lib/cijoe/public/octocat.png
91
+ - lib/cijoe/public/screen.css
92
+ - lib/cijoe/server.rb
93
+ - lib/cijoe/version.rb
94
+ - lib/cijoe/views/template.erb
95
+ - lib/mmmail.rb
96
+ - lib/smtp_tls.rb
97
+ - spec/email_spec.rb
98
+ - test/helper.rb
99
+ - test/test_cijoe.rb
100
+ has_rdoc: true
101
+ homepage: http://github.com/ldm314/cijoe
102
+ licenses: []
103
+
104
+ post_install_message:
105
+ rdoc_options:
106
+ - --charset=UTF-8
107
+ require_paths:
108
+ - lib
109
+ required_ruby_version: !ruby/object:Gem::Requirement
110
+ none: false
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ hash: 3
115
+ segments:
116
+ - 0
117
+ version: "0"
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ none: false
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ hash: 3
124
+ segments:
125
+ - 0
126
+ version: "0"
127
+ requirements: []
128
+
129
+ rubyforge_project:
130
+ rubygems_version: 1.3.7
131
+ signing_key:
132
+ specification_version: 3
133
+ summary: CI Joe is a simple Continuous Integration server.
134
+ test_files:
135
+ - spec/email_spec.rb
136
+ - test/helper.rb
137
+ - test/test_cijoe.rb