subordinate 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +46 -0
- data/README.md +23 -12
- data/lib/subordinate/version.rb +1 -1
- data/spec/fixtures/authentications.yml.sample +8 -6
- data/spec/spec_helper.rb +5 -1
- data/spec/subordinate/client/build_spec.rb +15 -15
- data/spec/subordinate/client/job_spec.rb +14 -14
- data/spec/subordinate/client/load_spec.rb +4 -6
- data/spec/subordinate/client/people_spec.rb +4 -6
- data/spec/subordinate/client/queue_spec.rb +4 -6
- data/spec/subordinate/client/system_spec.rb +4 -6
- data/spec/subordinate/client/view_spec.rb +9 -11
- data/spec/subordinate/client_spec.rb +4 -6
- metadata +4 -3
data/.travis.yml
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
---
|
2
|
+
language: ruby
|
3
|
+
script:
|
4
|
+
- bundle exec rspec
|
5
|
+
rvm:
|
6
|
+
- rbx-19mode
|
7
|
+
- 1.9.2
|
8
|
+
- 1.9.3
|
9
|
+
- 2.0.0
|
10
|
+
env:
|
11
|
+
global:
|
12
|
+
- secure: ! 'JyUmtS/9TPcO177P0YpIgt9aHU6Be40uhG8zM4x0IFT7/z0824iJFCNr4k86
|
13
|
+
|
14
|
+
CJnvF4ykHqQJPNmVQibmJjXFclYQcJbs6fXRWz0Bbiu7awO+W3/ZGOqzaG4W
|
15
|
+
|
16
|
+
0VNJPprWIjVRD9MtlBfruCVlEDz06Ssr/PSCzEAO0ozePM7LCak='
|
17
|
+
- secure: ! 'MKerFaIev3SZZr1kcZfQTH8B6WOv+a0ir0t9A8GcJRcFVOclOEEy55lwXLbF
|
18
|
+
|
19
|
+
1Sa2ol6i+ADV92GnZ/MvavgbUUuc34ylV+kgBkJ8nbuOE1xtT6bSEqYeLbSE
|
20
|
+
|
21
|
+
82zWEo2FSvenOc7qaVuqf7lR7S7acVAWP0tuyG06pA6myEHfptM='
|
22
|
+
- secure: ! 'GKejLb0DLwZV9gvVpDJry5BD8LNURZfq3U97Zf4aGl1+bb8lFteNHTclDLzL
|
23
|
+
|
24
|
+
sd4ELwq+Ek5aO2ZdhnGiyhBkVX4dqxMRGH8OYoUEUMX887UaWrME4T0ch1W4
|
25
|
+
|
26
|
+
8y6V+NTOl+LlWjhzeOA+vxhB7YRd4lzjNFLsJmuQieymBbdZAwo='
|
27
|
+
- secure: ! 'D8jIL+eWzjUDzUiJci9OFMvxqGvWSmY2PhjawYUcuwDsmC1HbIxsIf2PKSBY
|
28
|
+
|
29
|
+
TyE18KwCp+KcRrn6zQjpdkUgMaMYK9rVyGD5NQhOhNjns31zJmON5LPhTehf
|
30
|
+
|
31
|
+
5Rrn6UevypPdqhOLJzDp4Jo15UY1Q95glU5Q49I6+k3VR2jlxAM='
|
32
|
+
- secure: ! 'YjYOzWTAJnZqjqjxAO2tTKKCDh3dd7B4kAhc2i3v2uprL2z2WzgrQUKZRsZh
|
33
|
+
|
34
|
+
eaOxManOwD26oTk2F44tnSs/prLUG/6gLg+hw4FU04v+p9H5xcm1/q56btar
|
35
|
+
|
36
|
+
cr9suABpV7MIvOlBd4Pb2LJdyFlzTvw94xmJYTYg1jGwcKrYBF0='
|
37
|
+
- secure: ! 'GsmIF1EIKv/k7r59I4N1Bdbi+dsXWH97SPWHl/Gaat+zN8yXEwVmQuO0P6Nb
|
38
|
+
|
39
|
+
hzFTkvHJSE/aOAnQPxKs9qKV76/ERYPt1YZ1kUmQflCtgwWfx9K1MnGR6Ssy
|
40
|
+
|
41
|
+
4rXDbL14ERUm8DokrM4q2rjceg/Z75HSmBHUYtOb62XEzu2kpwg='
|
42
|
+
- secure: ! 'QP9gVy6BBC/fV43hGDChNE2ln5Zi0MdNYMUnLq40bfBwreo1B+gLWH5I3ZAj
|
43
|
+
|
44
|
+
RcMf+gLst3LMFu1hWtuCnRYH9L/ph8nwawkqNQoF22TJUCRFCGPUqrTJpzNg
|
45
|
+
|
46
|
+
yz6vt+XrtRZk1whJwJcRWwLX9gybVv5sB6qGQu8swsgLrNDvsrE='
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Subordinate
|
1
|
+
# Subordinate [![Build Status](https://travis-ci.org/jasontruluck/subordinate.png?branch=add-travis-ci)](https://travis-ci.org/jasontruluck/subordinate) [![Code Climate](https://codeclimate.com/github/jasontruluck/subordinate.png)](https://codeclimate.com/github/jasontruluck/subordinate)
|
2
2
|
|
3
3
|
Subordinate is a api wrapper for the Jenkins API. It is not exhaustive at the moment and is being built out.
|
4
4
|
|
@@ -18,6 +18,8 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Documentation
|
20
20
|
|
21
|
+
http://rdoc.info/github/jasontruluck/subordinate/master/index
|
22
|
+
|
21
23
|
## Configuration
|
22
24
|
|
23
25
|
Configuration allows for specifying your Jenkins instances variables
|
@@ -34,10 +36,10 @@ Within an initializer `config/initializer/subordinate.rb`
|
|
34
36
|
|
35
37
|
```ruby
|
36
38
|
Subordinate.configure do |c|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
39
|
+
c.subdomain = "subdomain"
|
40
|
+
c.domain = "domain"
|
41
|
+
c.port = 1234
|
42
|
+
c.ssl = false
|
41
43
|
end
|
42
44
|
```
|
43
45
|
|
@@ -91,6 +93,14 @@ Currently can safe restart, restart, and quiet down
|
|
91
93
|
client.restart
|
92
94
|
```
|
93
95
|
|
96
|
+
###[People](http://rdoc.info/github/jasontruluck/subordinate/master/Subordinate/Client/People)
|
97
|
+
|
98
|
+
Retrieve the users on the Jenkins server
|
99
|
+
|
100
|
+
```ruby
|
101
|
+
client.people
|
102
|
+
```
|
103
|
+
|
94
104
|
### [Build Queue](http://rdoc.info/github/jasontruluck/subordinate/master/Subordinate/Client/Queue)
|
95
105
|
|
96
106
|
Retrieves the current build queue for the Jenkins server
|
@@ -122,7 +132,7 @@ The default depth is 0 for all methods.
|
|
122
132
|
`tree` parameters are more efficient than using depth with exclude. They are available ot any methods that except them via options as well
|
123
133
|
|
124
134
|
```ruby
|
125
|
-
client.root({:tree => "jobs[name],views[name,jobs[name]]"})
|
135
|
+
client.root({:tree => "jobs[name],views[name,jobs[name]]"})
|
126
136
|
```
|
127
137
|
|
128
138
|
A note from Jenkins: for array-type properties (such as jobs in this example), the name must be given in the original plural, not in the singular as the element would appear in XML (<job>). This will be more natural for e.g. json?tree=jobs[name] anyway: the JSON writer does not do plural-to-singular mangling because arrays are represented explicitly.
|
@@ -137,12 +147,13 @@ Add a sample authentications file to your `spec/fixtures` directory:
|
|
137
147
|
|
138
148
|
```ruby
|
139
149
|
#spec/fixtures/authentications.yml
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
150
|
+
USERNAME: jasontruluck # Your Username
|
151
|
+
TOKEN: 12345678901234567890 # Your Jenkins Token (found at jenkins-server/user/your-user-name/configure)
|
152
|
+
DOMAIN: mydomain.com # The domain of your Jenkins server
|
153
|
+
PORT: 8080 # The port of your Jenkins Server
|
154
|
+
SUBDOMAIN: jenkins # The subdomain of your Jenkins Server
|
155
|
+
JOB: My-Jenkins-Job # The job that you want to run tests on
|
156
|
+
VIEW: My-awesome-view # The view that you want to run tests on
|
146
157
|
```
|
147
158
|
|
148
159
|
A sample is included in the [source](https://github.com/jasontruluck/subordinate/blob/master/spec/fixtures/authentications.yml.sample).
|
data/lib/subordinate/version.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
#spec/fixtures/authentications.yml
|
2
|
+
USERNAME: jasontruluck # Your Username
|
3
|
+
TOKEN: 12345678901234567890 # Your Jenkins Token (found at jenkins-server/user/your-user-name/configure)
|
4
|
+
DOMAIN: mydomain.com # The domain of your Jenkins server
|
5
|
+
PORT: 8080 # The port of your Jenkins Server
|
6
|
+
SUBDOMAIN: jenkins # The subdomain of your Jenkins Server
|
7
|
+
JOB: My-Jenkins-Job # The job that you want to run tests on
|
8
|
+
VIEW: My-awesome-view # The view that you want to run tests on
|
data/spec/spec_helper.rb
CHANGED
@@ -22,7 +22,11 @@ require 'vcr'
|
|
22
22
|
require "webmock/rspec"
|
23
23
|
require "mocha/api"
|
24
24
|
|
25
|
-
authentications =
|
25
|
+
authentications = File.expand_path("../fixtures/authentications.yml", __FILE__)
|
26
|
+
if File.exists?(authentications)
|
27
|
+
ENV.update YAML::load(File.open(authentications))
|
28
|
+
end
|
29
|
+
|
26
30
|
VCR.configure do |c|
|
27
31
|
c.cassette_library_dir = 'spec/cassettes'
|
28
32
|
c.hook_into :faraday
|
@@ -1,22 +1,22 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
|
3
|
+
|
4
4
|
|
5
5
|
# Client Spec
|
6
6
|
describe Subordinate::Client do
|
7
7
|
before do
|
8
8
|
Subordinate.reset!
|
9
9
|
Subordinate.configure do |c|
|
10
|
-
c.subdomain =
|
11
|
-
c.domain =
|
12
|
-
c.port =
|
10
|
+
c.subdomain = ENV["SUBDOMAIN"]
|
11
|
+
c.domain = ENV["DOMAIN"]
|
12
|
+
c.port = ENV["PORT"]
|
13
13
|
c.ssl = false
|
14
14
|
end
|
15
15
|
end
|
16
|
-
let(:subordinate) { Subordinate::Client.new(:username =>
|
16
|
+
let(:subordinate) { Subordinate::Client.new(:username => ENV["USERNAME"], :api_token => ENV["TOKEN"]) }
|
17
17
|
|
18
18
|
describe "#build", :vcr do
|
19
|
-
let(:current_response) { subordinate.build(
|
19
|
+
let(:current_response) { subordinate.build(ENV["JOB"], 1) }
|
20
20
|
|
21
21
|
it "returns the job response" do
|
22
22
|
current_response.should_not be_nil
|
@@ -95,42 +95,42 @@ describe Subordinate::Client do
|
|
95
95
|
|
96
96
|
describe "#build_timestamp" do
|
97
97
|
it "returns the timestamp of the specified build" do
|
98
|
-
stub_request(:get, "#{subordinate.api_endpoint}/job/#{
|
98
|
+
stub_request(:get, "#{subordinate.api_endpoint}/job/#{ENV["JOB"]}/1/buildTimestamp").
|
99
99
|
to_return(:status => 302, :body => "3/25/13 3:30 AM", :headers => {})
|
100
100
|
|
101
101
|
|
102
|
-
subordinate.build_timestamp(
|
102
|
+
subordinate.build_timestamp(ENV["JOB"], 1).should == "3/25/13 3:30 AM"
|
103
103
|
end
|
104
104
|
|
105
105
|
it "returns the timestamp in the specified format" do
|
106
|
-
stub_request(:get, "#{subordinate.api_endpoint}/job/#{
|
106
|
+
stub_request(:get, "#{subordinate.api_endpoint}/job/#{ENV["JOB"]}/1/buildTimestamp?format=yyyy/MM/dd").
|
107
107
|
to_return(:status => 302, :body => "2013/03/25", :headers => {})
|
108
108
|
|
109
|
-
subordinate.build_timestamp(
|
109
|
+
subordinate.build_timestamp(ENV["JOB"], 1, "yyyy/MM/dd").should == "2013/03/25"
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
113
|
describe "#console_output_for_build", :vcr do
|
114
114
|
it "returns the console output for a complete build" do
|
115
|
-
response = subordinate.console_output_for_build(
|
115
|
+
response = subordinate.console_output_for_build(ENV["JOB"], 1)
|
116
116
|
response.should_not be_nil
|
117
117
|
response.should_not include("javax.servlet.ServletException:")
|
118
118
|
end
|
119
119
|
|
120
120
|
it "returns pre-formatted output" do
|
121
|
-
response = subordinate.console_output_for_build(
|
121
|
+
response = subordinate.console_output_for_build(ENV["JOB"], 1, nil, true)
|
122
122
|
response.should_not be_nil
|
123
123
|
response.should_not include("javax.servlet.ServletException:")
|
124
124
|
end
|
125
125
|
|
126
126
|
context "byte size arguement" do
|
127
127
|
it "returns data at byte 2000" do
|
128
|
-
subordinate.console_output_for_build(
|
128
|
+
subordinate.console_output_for_build(ENV["JOB"], 1, 2000).should_not be_nil
|
129
129
|
end
|
130
130
|
|
131
131
|
it "when passed an offset of 2000 it is offset by 2000 bytes" do
|
132
|
-
output1 = subordinate.console_output_for_build(
|
133
|
-
output2 = subordinate.console_output_for_build(
|
132
|
+
output1 = subordinate.console_output_for_build(ENV["JOB"], 1, 2000)
|
133
|
+
output2 = subordinate.console_output_for_build(ENV["JOB"], 1, 0)
|
134
134
|
|
135
135
|
output1.bytesize.should < output2.bytesize
|
136
136
|
end
|
@@ -1,22 +1,22 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
|
3
|
+
|
4
4
|
|
5
5
|
# Client Spec
|
6
6
|
describe Subordinate::Client do
|
7
7
|
before do
|
8
8
|
Subordinate.reset!
|
9
9
|
Subordinate.configure do |c|
|
10
|
-
c.subdomain =
|
11
|
-
c.domain =
|
12
|
-
c.port =
|
10
|
+
c.subdomain = ENV["SUBDOMAIN"]
|
11
|
+
c.domain = ENV["DOMAIN"]
|
12
|
+
c.port = ENV["PORT"]
|
13
13
|
c.ssl = false
|
14
14
|
end
|
15
15
|
end
|
16
|
-
let(:subordinate) { Subordinate::Client.new(:username =>
|
16
|
+
let(:subordinate) { Subordinate::Client.new(:username => ENV["USERNAME"], :api_token => ENV["TOKEN"]) }
|
17
17
|
|
18
18
|
describe "#job", :vcr do
|
19
|
-
let(:current_response) { subordinate.job(
|
19
|
+
let(:current_response) { subordinate.job(ENV["JOB"]) }
|
20
20
|
|
21
21
|
it "should return the job response" do
|
22
22
|
current_response.should_not be_nil
|
@@ -135,37 +135,37 @@ describe Subordinate::Client do
|
|
135
135
|
|
136
136
|
describe "#build_job" do
|
137
137
|
it "builds the job specified" do
|
138
|
-
stub_request(:post, "#{subordinate.api_endpoint}/job/#{
|
138
|
+
stub_request(:post, "#{subordinate.api_endpoint}/job/#{ENV["JOB"]}/build").
|
139
139
|
to_return(:status => 302, :body => "", :headers => {})
|
140
140
|
|
141
|
-
subordinate.build_job(
|
141
|
+
subordinate.build_job(ENV["JOB"]).should == 302
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
145
145
|
describe "#disable_job" do
|
146
146
|
it "disables the specified job" do
|
147
|
-
stub_request(:post, "#{subordinate.api_endpoint}/job/#{
|
147
|
+
stub_request(:post, "#{subordinate.api_endpoint}/job/#{ENV["JOB"]}/disable").
|
148
148
|
to_return(:status => 302, :body => "", :headers => {})
|
149
149
|
|
150
|
-
subordinate.disable_job(
|
150
|
+
subordinate.disable_job(ENV["JOB"]).should == 302
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
154
154
|
describe "#enable_job" do
|
155
155
|
it "enables the specified job" do
|
156
|
-
stub_request(:post, "#{subordinate.api_endpoint}/job/#{
|
156
|
+
stub_request(:post, "#{subordinate.api_endpoint}/job/#{ENV["JOB"]}/enable").
|
157
157
|
to_return(:status => 302, :body => "", :headers => {})
|
158
158
|
|
159
|
-
subordinate.enable_job(
|
159
|
+
subordinate.enable_job(ENV["JOB"]).should == 302
|
160
160
|
end
|
161
161
|
end
|
162
162
|
|
163
163
|
describe "#delete_job" do
|
164
164
|
it "deletes the specified job" do
|
165
|
-
stub_request(:post, "#{subordinate.api_endpoint}/job/#{
|
165
|
+
stub_request(:post, "#{subordinate.api_endpoint}/job/#{ENV["JOB"]}/delete").
|
166
166
|
to_return(:status => 302, :body => "", :headers => {})
|
167
167
|
|
168
|
-
subordinate.delete_job(
|
168
|
+
subordinate.delete_job(ENV["JOB"]).should == 302
|
169
169
|
end
|
170
170
|
end
|
171
171
|
end
|
@@ -1,19 +1,17 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
auth = YAML::load(File.open(File.expand_path("../../../fixtures/authentications.yml", __FILE__)))
|
4
|
-
|
5
3
|
# Queue Spec
|
6
4
|
describe Subordinate::Client do
|
7
5
|
before do
|
8
6
|
Subordinate.reset!
|
9
7
|
Subordinate.configure do |c|
|
10
|
-
c.subdomain =
|
11
|
-
c.domain =
|
12
|
-
c.port =
|
8
|
+
c.subdomain = ENV["SUBDOMAIN"]
|
9
|
+
c.domain = ENV["DOMAIN"]
|
10
|
+
c.port = ENV["PORT"]
|
13
11
|
c.ssl = false
|
14
12
|
end
|
15
13
|
end
|
16
|
-
let(:subordinate) { Subordinate::Client.new(:username =>
|
14
|
+
let(:subordinate) { Subordinate::Client.new(:username => ENV["USERNAME"], :api_token => ENV["TOKEN"]) }
|
17
15
|
|
18
16
|
describe "#load_statistics", :vcr do
|
19
17
|
let(:current_response) { subordinate.load_statistics }
|
@@ -1,19 +1,17 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
auth = YAML::load(File.open(File.expand_path("../../../fixtures/authentications.yml", __FILE__)))
|
4
|
-
|
5
3
|
# Queue Spec
|
6
4
|
describe Subordinate::Client do
|
7
5
|
before do
|
8
6
|
Subordinate.reset!
|
9
7
|
Subordinate.configure do |c|
|
10
|
-
c.subdomain =
|
11
|
-
c.domain =
|
12
|
-
c.port =
|
8
|
+
c.subdomain = ENV["SUBDOMAIN"]
|
9
|
+
c.domain = ENV["DOMAIN"]
|
10
|
+
c.port = ENV["PORT"]
|
13
11
|
c.ssl = false
|
14
12
|
end
|
15
13
|
end
|
16
|
-
let(:subordinate) { Subordinate::Client.new(:username =>
|
14
|
+
let(:subordinate) { Subordinate::Client.new(:username => ENV["USERNAME"], :api_token => ENV["TOKEN"]) }
|
17
15
|
|
18
16
|
describe "#people", :vcr do
|
19
17
|
let(:current_response) { subordinate.people }
|
@@ -1,19 +1,17 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
auth = YAML::load(File.open(File.expand_path("../../../fixtures/authentications.yml", __FILE__)))
|
4
|
-
|
5
3
|
# Queue Spec
|
6
4
|
describe Subordinate::Client do
|
7
5
|
before do
|
8
6
|
Subordinate.reset!
|
9
7
|
Subordinate.configure do |c|
|
10
|
-
c.subdomain =
|
11
|
-
c.domain =
|
12
|
-
c.port =
|
8
|
+
c.subdomain = ENV["SUBDOMAIN"]
|
9
|
+
c.domain = ENV["DOMAIN"]
|
10
|
+
c.port = ENV["PORT"]
|
13
11
|
c.ssl = false
|
14
12
|
end
|
15
13
|
end
|
16
|
-
let(:subordinate) { Subordinate::Client.new(:username =>
|
14
|
+
let(:subordinate) { Subordinate::Client.new(:username => ENV["USERNAME"], :api_token => ENV["TOKEN"]) }
|
17
15
|
|
18
16
|
describe "#build_queue", :vcr do
|
19
17
|
let(:current_response) { subordinate.build_queue }
|
@@ -1,19 +1,17 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
auth = YAML::load(File.open(File.expand_path("../../../fixtures/authentications.yml", __FILE__)))
|
4
|
-
|
5
3
|
# Client Spec
|
6
4
|
describe Subordinate::Client do
|
7
5
|
before do
|
8
6
|
Subordinate.reset!
|
9
7
|
Subordinate.configure do |c|
|
10
|
-
c.subdomain =
|
11
|
-
c.domain =
|
12
|
-
c.port =
|
8
|
+
c.subdomain = ENV["SUBDOMAIN"]
|
9
|
+
c.domain = ENV["DOMAIN"]
|
10
|
+
c.port = ENV["PORT"]
|
13
11
|
c.ssl = false
|
14
12
|
end
|
15
13
|
end
|
16
|
-
let(:subordinate) { Subordinate::Client.new(:username =>
|
14
|
+
let(:subordinate) { Subordinate::Client.new(:username => ENV["USERNAME"], :api_token => ENV["TOKEN"]) }
|
17
15
|
|
18
16
|
describe "#root", :vcr do
|
19
17
|
let(:current_response) { subordinate.root }
|
@@ -1,23 +1,21 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
auth = YAML::load(File.open(File.expand_path("../../../fixtures/authentications.yml", __FILE__)))
|
4
|
-
|
5
3
|
# View Spec
|
6
4
|
describe Subordinate::Client do
|
7
5
|
before do
|
8
6
|
Subordinate.reset!
|
9
7
|
Subordinate.configure do |c|
|
10
|
-
c.subdomain =
|
11
|
-
c.domain =
|
12
|
-
c.port =
|
8
|
+
c.subdomain = ENV["SUBDOMAIN"]
|
9
|
+
c.domain = ENV["DOMAIN"]
|
10
|
+
c.port = ENV["PORT"]
|
13
11
|
c.ssl = false
|
14
12
|
end
|
15
13
|
end
|
16
14
|
|
17
|
-
let(:subordinate) { Subordinate::Client.new(:username =>
|
15
|
+
let(:subordinate) { Subordinate::Client.new(:username => ENV["USERNAME"], :api_token => ENV["TOKEN"]) }
|
18
16
|
|
19
17
|
describe "#view", :vcr do
|
20
|
-
let(:current_response) { subordinate.view(
|
18
|
+
let(:current_response) { subordinate.view(ENV["VIEW"]) }
|
21
19
|
|
22
20
|
it "returns the view response" do
|
23
21
|
current_response.should_not be_nil
|
@@ -76,19 +74,19 @@ describe Subordinate::Client do
|
|
76
74
|
|
77
75
|
describe "#add_job_to_view" do
|
78
76
|
it "responds with a success" do
|
79
|
-
stub_request(:post, "#{subordinate.api_endpoint}/view/#{
|
77
|
+
stub_request(:post, "#{subordinate.api_endpoint}/view/#{ENV["VIEW"]}/addJobToView").
|
80
78
|
to_return(:status => 200, :body => "", :headers => {})
|
81
79
|
|
82
|
-
subordinate.add_job_to_view(
|
80
|
+
subordinate.add_job_to_view(ENV["VIEW"], ENV["JOB"]).status.should == 200
|
83
81
|
end
|
84
82
|
end
|
85
83
|
|
86
84
|
describe "#remove_job_from_view" do
|
87
85
|
it "responds with a success" do
|
88
|
-
stub_request(:post, "#{subordinate.api_endpoint}/view/#{
|
86
|
+
stub_request(:post, "#{subordinate.api_endpoint}/view/#{ENV["VIEW"]}/removeJobFromView").
|
89
87
|
to_return(:status => 200, :body => "", :headers => {})
|
90
88
|
|
91
|
-
subordinate.remove_job_from_view(
|
89
|
+
subordinate.remove_job_from_view(ENV["VIEW"], ENV["JOB"]).status.should == 200
|
92
90
|
end
|
93
91
|
end
|
94
92
|
end
|
@@ -1,15 +1,13 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
auth = YAML::load(File.open(File.expand_path("../../fixtures/authentications.yml", __FILE__)))
|
4
|
-
|
5
3
|
# Client Spec
|
6
4
|
describe Subordinate::Client do
|
7
5
|
before do
|
8
6
|
Subordinate.reset!
|
9
7
|
Subordinate.configure do |c|
|
10
|
-
c.subdomain =
|
11
|
-
c.domain =
|
12
|
-
c.port =
|
8
|
+
c.subdomain = ENV["SUBDOMAIN"]
|
9
|
+
c.domain = ENV["DOMAIN"]
|
10
|
+
c.port = ENV["PORT"]
|
13
11
|
c.ssl = false
|
14
12
|
end
|
15
13
|
end
|
@@ -24,7 +22,7 @@ describe Subordinate::Client do
|
|
24
22
|
end
|
25
23
|
|
26
24
|
it "works with basic username and api token", :vcr do
|
27
|
-
Subordinate::Client.new(:username =>
|
25
|
+
Subordinate::Client.new(:username => ENV["USERNAME"], :api_token => ENV["TOKEN"]).root
|
28
26
|
.should_not
|
29
27
|
raise_exception
|
30
28
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: subordinate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -227,6 +227,7 @@ extensions: []
|
|
227
227
|
extra_rdoc_files: []
|
228
228
|
files:
|
229
229
|
- .gitignore
|
230
|
+
- .travis.yml
|
230
231
|
- Gemfile
|
231
232
|
- LICENSE.txt
|
232
233
|
- README.md
|
@@ -270,7 +271,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
270
271
|
version: '0'
|
271
272
|
segments:
|
272
273
|
- 0
|
273
|
-
hash:
|
274
|
+
hash: 4562863513787901160
|
274
275
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
275
276
|
none: false
|
276
277
|
requirements:
|
@@ -279,7 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
279
280
|
version: '0'
|
280
281
|
segments:
|
281
282
|
- 0
|
282
|
-
hash:
|
283
|
+
hash: 4562863513787901160
|
283
284
|
requirements: []
|
284
285
|
rubyforge_project:
|
285
286
|
rubygems_version: 1.8.24
|