bamboo-client 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/features/remote.feature +4 -1
- data/features/step_definitions/remote_steps.rb +4 -0
- data/lib/bamboo-client/http/xml.rb +10 -0
- data/lib/bamboo-client/remote.rb +1 -1
- data/lib/bamboo-client/version.rb +1 -1
- data/spec/bamboo-client/http/xml_spec.rb +5 -1
- data/spec/bamboo-client/remote_spec.rb +7 -2
- metadata +2 -2
data/features/remote.feature
CHANGED
@@ -15,4 +15,7 @@ Feature: Bamboo Remote client
|
|
15
15
|
Scenario: Fetch a build result
|
16
16
|
When I fetch a build result
|
17
17
|
Then the build result should have a key
|
18
|
-
And the build result should have a state
|
18
|
+
And the build result should have a state
|
19
|
+
|
20
|
+
Scenario: Log out
|
21
|
+
Then I should be able to log out
|
@@ -12,6 +12,7 @@ module Bamboo
|
|
12
12
|
def initialize(doc)
|
13
13
|
@doc = doc
|
14
14
|
puts doc.to_s if $DEBUG
|
15
|
+
assert_no_error
|
15
16
|
end
|
16
17
|
|
17
18
|
def text_for(css)
|
@@ -28,6 +29,15 @@ module Bamboo
|
|
28
29
|
|
29
30
|
klass.new node, *extra_args
|
30
31
|
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def assert_no_error
|
36
|
+
errors = @doc.css("errors error").map { |e| e.text }
|
37
|
+
unless errors.empty?
|
38
|
+
raise Error, "#{errors.join ' '}"
|
39
|
+
end
|
40
|
+
end
|
31
41
|
end # Doc
|
32
42
|
|
33
43
|
def post(path, data = {})
|
data/lib/bamboo-client/remote.rb
CHANGED
@@ -19,7 +19,11 @@ module Bamboo
|
|
19
19
|
end
|
20
20
|
|
21
21
|
describe Xml::Doc do
|
22
|
-
let(:wrapped) {
|
22
|
+
let(:wrapped) {
|
23
|
+
m = mock("nokogiri document")
|
24
|
+
m.stub!(:css).with("errors error").and_return []
|
25
|
+
m
|
26
|
+
}
|
23
27
|
let(:doc) { Xml::Doc.new(wrapped)}
|
24
28
|
|
25
29
|
it "returns the text of the given CSS selector" do
|
@@ -6,7 +6,12 @@ module Bamboo
|
|
6
6
|
let(:url) { "http://bamboo.example.com" }
|
7
7
|
let(:http) { mock(Http::Xml) }
|
8
8
|
let(:client) { Remote.new(http) }
|
9
|
-
let(:document) {
|
9
|
+
let(:document) {
|
10
|
+
m = mock(Http::Xml::Doc)
|
11
|
+
m.stub(:css).with("errors error").and_return []
|
12
|
+
|
13
|
+
m
|
14
|
+
}
|
10
15
|
|
11
16
|
context "authorization" do
|
12
17
|
it "logs in" do
|
@@ -29,7 +34,7 @@ module Bamboo
|
|
29
34
|
it "logs out" do
|
30
35
|
http.should_receive(:post).with(
|
31
36
|
"/api/rest/logout.action",
|
32
|
-
:
|
37
|
+
:auth => "foo"
|
33
38
|
)
|
34
39
|
|
35
40
|
client.instance_variable_set "@token", "foo"
|