bamboo-client 0.0.2 → 0.0.3

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.
@@ -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
@@ -33,3 +33,7 @@ end
33
33
  Then /^I should be able to get the latest result$/ do
34
34
  @builds.first.latest_results.should be_kind_of(Bamboo::Client::Remote::BuildResult)
35
35
  end
36
+
37
+ Then /^I should be able to log out$/ do
38
+ client.logout
39
+ end
@@ -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 = {})
@@ -24,7 +24,7 @@ module Bamboo
24
24
  end
25
25
 
26
26
  def logout
27
- post :logout, :token => token
27
+ post :logout, :auth => token
28
28
  @token = nil
29
29
  end
30
30
 
@@ -1,5 +1,5 @@
1
1
  module Bamboo
2
2
  module Client
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -19,7 +19,11 @@ module Bamboo
19
19
  end
20
20
 
21
21
  describe Xml::Doc do
22
- let(:wrapped) { mock("nokogiri document") }
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) { mock(Http::Xml::Doc) }
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
- :token => "foo"
37
+ :auth => "foo"
33
38
  )
34
39
 
35
40
  client.instance_variable_set "@token", "foo"
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jari Bakken