jenkins_api_client 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,41 +26,6 @@ describe JenkinsApi::Client do
26
26
  end
27
27
  end
28
28
 
29
- describe "#debug" do
30
- it "The default for debug should be false" do
31
- client = JenkinsApi::Client.new(
32
- :server_ip => '127.0.0.1',
33
- :server_port => 8080,
34
- :username => 'username',
35
- :password => 'password'
36
- )
37
- client.debug.should == false
38
- end
39
-
40
- it "Should be able to set the debug value" do
41
- client = JenkinsApi::Client.new(
42
- :server_ip => '127.0.0.1',
43
- :server_port => 8080,
44
- :username => 'username',
45
- :password => 'password',
46
- :debug => true
47
- )
48
- client.debug.should == true
49
- end
50
-
51
- it "Should be able to toggle the debug value" do
52
- client = JenkinsApi::Client.new(
53
- :server_ip => '127.0.0.1',
54
- :server_port => 8080,
55
- :username => 'username',
56
- :password => 'password',
57
- :debug => true
58
- )
59
- client.toggle_debug
60
- client.debug.should == false
61
- end
62
- end
63
-
64
29
  describe "#SubClassAccessorMethods" do
65
30
  describe "#job" do
66
31
  it "Should return a Client::Job object" do
@@ -124,6 +89,41 @@ describe JenkinsApi::Client do
124
89
  end
125
90
 
126
91
  describe "InstanceMethods" do
92
+ describe "#debug" do
93
+ it "The default for debug should be false" do
94
+ client = JenkinsApi::Client.new(
95
+ :server_ip => '127.0.0.1',
96
+ :server_port => 8080,
97
+ :username => 'username',
98
+ :password => 'password'
99
+ )
100
+ client.debug.should == false
101
+ end
102
+
103
+ it "Should be able to set the debug value" do
104
+ client = JenkinsApi::Client.new(
105
+ :server_ip => '127.0.0.1',
106
+ :server_port => 8080,
107
+ :username => 'username',
108
+ :password => 'password',
109
+ :debug => true
110
+ )
111
+ client.debug.should == true
112
+ end
113
+
114
+ it "Should be able to toggle the debug value" do
115
+ client = JenkinsApi::Client.new(
116
+ :server_ip => '127.0.0.1',
117
+ :server_port => 8080,
118
+ :username => 'username',
119
+ :password => 'password',
120
+ :debug => true
121
+ )
122
+ client.toggle_debug
123
+ client.debug.should == false
124
+ end
125
+ end
126
+
127
127
  describe "#getroot" do
128
128
  it "is defined with no parameters" do
129
129
  expect(
@@ -163,6 +163,30 @@ describe JenkinsApi::Client do
163
163
  ).not_to raise_error(NoMethodError)
164
164
  end
165
165
  end
166
+
167
+ describe "#get_jenkins_version" do
168
+ it "is defined and accepts no parameters" do
169
+ expect(
170
+ lambda { @client.get_jenkins_version }
171
+ ).not_to raise_error(NoMethodError)
172
+ end
173
+ end
174
+
175
+ describe "#get_hudson_version" do
176
+ it "is defined and accepts no parameters" do
177
+ expect(
178
+ lambda { @client.get_hudson_version }
179
+ ).not_to raise_error(NoMethodError)
180
+ end
181
+ end
182
+
183
+ describe "#get_server_date" do
184
+ it "is defined and accepts no parameters" do
185
+ expect(
186
+ lambda { @client.get_server_date }
187
+ ).not_to raise_error(NoMethodError)
188
+ end
189
+ end
166
190
  end
167
191
  end
168
192
 
@@ -134,6 +134,22 @@ describe JenkinsApi::Client::Job do
134
134
  end
135
135
  end
136
136
 
137
+ describe "#add_email_notification" do
138
+ it "accepts email address and adds to existing job" do
139
+ params = {
140
+ :name => "email_notification_test_job"
141
+ }
142
+ @client.should_receive(:post_config)
143
+ @job.create_freestyle(params)
144
+ @client.should_receive(:get_config).and_return(@sample_job_xml)
145
+ @client.should_receive(:post_config)
146
+ @job.add_email_notification(
147
+ :name => "email_notification_test_job",
148
+ :notification_email => "testuser@testdomain.com"
149
+ )
150
+ end
151
+ end
152
+
137
153
  describe "#add_skype_notification" do
138
154
  it "accepts skype configuration and adds to existing job" do
139
155
  params = {
@@ -41,10 +41,18 @@ describe JenkinsApi::Client::System do
41
41
  end
42
42
  end
43
43
 
44
+ describe "#reload" do
45
+ it "sends a reload request to the server" do
46
+ @client.should_receive(:api_post_request).with("/reload")
47
+ @system.reload
48
+ end
49
+ end
50
+
44
51
  describe "#wait_for_ready" do
45
52
  it "exits if the response body doesn't have the wait message" do
46
53
  @client.should_receive(:get_root).and_return(Net::HTTP.get_response(URI('http://example.com/index.html')))
47
54
  @client.should_receive(:debug)
55
+ @client.should_receive(:timeout)
48
56
  @system.wait_for_ready
49
57
  end
50
58
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jenkins_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-15 00:00:00.000000000 Z
12
+ date: 2013-03-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -214,6 +214,7 @@ files:
214
214
  - spec/func_tests/spec_helper.rb
215
215
  - spec/func_tests/system_spec.rb
216
216
  - spec/func_tests/view_spec.rb
217
+ - spec/unit_tests/build_queue_spec.rb
217
218
  - spec/unit_tests/client_spec.rb
218
219
  - spec/unit_tests/fixtures/files/computer_sample.xml
219
220
  - spec/unit_tests/fixtures/files/job_sample.xml
@@ -242,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
242
243
  version: '0'
243
244
  requirements: []
244
245
  rubyforge_project:
245
- rubygems_version: 1.8.24
246
+ rubygems_version: 1.8.23
246
247
  signing_key:
247
248
  specification_version: 3
248
249
  summary: Jenkins JSON API Client