go_api_client 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- go_api_client (0.0.4)
4
+ go_api_client (0.0.6)
5
5
  nokogiri
6
6
 
7
7
  GEM
@@ -1,6 +1,6 @@
1
1
  module GoApiClient
2
2
  class Pipeline
3
- attr_reader :details_link, :id, :commit_messages
3
+ attr_reader :details_link, :id, :commit_messages, :label
4
4
  attr_accessor :stages
5
5
 
6
6
  def initialize(details_link)
@@ -1,3 +1,3 @@
1
1
  module GoApiClient
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -0,0 +1,25 @@
1
+ require "test_helper"
2
+
3
+ class PipelineTest < Test::Unit::TestCase
4
+
5
+ def setup()
6
+ stub_request(:get, "http://localhost:8153/go/api/pipelines/defaultPipeline/1.xml").to_return(:body => file_contents("pipelines_1.xml"))
7
+ end
8
+
9
+ def test_fetch_populates_necessary_fields
10
+ link = "http://localhost:8153/go/api/pipelines/defaultPipeline/1.xml"
11
+ pipeline = GoApiClient::Pipeline.new(link)
12
+ pipeline.fetch
13
+
14
+ assert_equal "1", pipeline.label
15
+ assert_equal ["Update README"], pipeline.commit_messages
16
+ end
17
+
18
+ def test_pipeline_instance_identified_by_details_link
19
+ link = "http://localhost:8153/go/api/pipelines/defaultPipeline/1.xml"
20
+ pipeline = GoApiClient::Pipeline.new(link)
21
+
22
+ assert pipeline.same?(link)
23
+ assert(false == pipeline.same?("http://localhost:8153/go/api"))
24
+ end
25
+ end
@@ -1,6 +1,6 @@
1
1
  require "test_helper"
2
2
 
3
- class IntegrationTest < Test::Unit::TestCase
3
+ class StageTest < Test::Unit::TestCase
4
4
 
5
5
  def setup()
6
6
  stub_request(:get, "http://localhost:8153/go/api/pipelines/defaultPipeline/stages.xml").to_return(:body => file_contents("stages.xml"))
@@ -11,10 +11,10 @@ class IntegrationTest < Test::Unit::TestCase
11
11
  stub_request(:get, "http://localhost:8153/go/api/jobs/2.xml").to_return(:body => file_contents("jobs_2.xml"))
12
12
  end
13
13
 
14
- def test_end_to_end
14
+ def test_stage
15
15
  pipelines = GoApiClient.runs("localhost:8153")
16
16
  stages = pipelines.first.stages
17
-
17
+
18
18
  assert_equal 1, pipelines.count
19
19
  assert_equal 2, stages.count
20
20
  assert_equal "oogabooga <twgosaas@gmail.com>", pipelines.first.authors
@@ -26,7 +26,6 @@ class IntegrationTest < Test::Unit::TestCase
26
26
  assert_equal "Units", stages.last.name
27
27
  assert_equal ["Update README"], pipelines.first.commit_messages
28
28
 
29
- assert_not_nil stages.first.jobs.first
30
29
  assert_equal "http://localhost:8153/go/files/defaultPipeline/1/Acceptance/1/Test/cruise-output/console.log", stages.first.jobs.first.console_log_url
31
30
  assert_equal "http://localhost:8153/go/files/defaultPipeline/1/Units/1/Test/cruise-output/console.log", stages.last.jobs.first.console_log_url
32
31
  end
data/test/test_helper.rb CHANGED
@@ -1,12 +1,10 @@
1
1
  require 'test/unit'
2
- require 'go_api_client/test'
3
-
4
2
  require 'go_api_client'
5
-
3
+ Dir["go_api_client/**/*.rb"].each {|f| require f}
6
4
  require 'webmock/test_unit'
7
5
 
8
6
  def file_contents(file_name)
9
- File.read(File.expand_path("../../fixtures/#{file_name}", __FILE__))
7
+ File.read(File.expand_path("../../test/fixtures/#{file_name}", __FILE__))
10
8
  end
11
9
 
12
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: go_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-27 00:00:00.000000000Z
12
+ date: 2012-02-28 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
16
- requirement: &2211000320 !ruby/object:Gem::Requirement
16
+ requirement: &70186482958560 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2211000320
24
+ version_requirements: *70186482958560
25
25
  description: This gem parses atom feed generated by the Go Continuous Integration
26
26
  server and provides an OO representation of the pipelines and stages.
27
27
  email:
@@ -55,7 +55,8 @@ files:
55
55
  - test/fixtures/stages.xml
56
56
  - test/fixtures/stages_1.xml
57
57
  - test/fixtures/stages_2.xml
58
- - test/go_api_client/integration_test.rb
58
+ - test/go_api_client/pipeline_test.rb
59
+ - test/go_api_client/stage_test.rb
59
60
  - test/test_helper.rb
60
61
  homepage: ''
61
62
  licenses: []
@@ -90,5 +91,6 @@ test_files:
90
91
  - test/fixtures/stages.xml
91
92
  - test/fixtures/stages_1.xml
92
93
  - test/fixtures/stages_2.xml
93
- - test/go_api_client/integration_test.rb
94
+ - test/go_api_client/pipeline_test.rb
95
+ - test/go_api_client/stage_test.rb
94
96
  - test/test_helper.rb