kalibro_client 0.2.0 → 0.3.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 445483700c4558a87e28642b871c69e50bf92f17
4
- data.tar.gz: 74b45e5f4d7f12b4ad7fc22744cd38658fd029f6
3
+ metadata.gz: 7a4214e47a7f3f799e57cfc42bcb8228c30e47ab
4
+ data.tar.gz: 160530db52e0e23314b39c2d59cdb353356dfe39
5
5
  SHA512:
6
- metadata.gz: 2e434bee814c6ccff290e4d16e8509341f4d2eca526fd81206325d8c426710bb6518281cdd03ebad652be15a18fae56ac897efacf5f1298436c39049f3fdf971
7
- data.tar.gz: a3fa03fb905c25d1786ab1cbc7c0a6edf8bbf1874ca341275f50cf90ed781d7fa7ed5d8d65130c3dce29ac64babdadf76c0ea4f3ab81efa71eb6a6ac71f7d61f
6
+ metadata.gz: 374887c5ff39d2947fe927eae6d72191b1e032aec1fc51d8dbfda556a0d7c6ec9bb759e5300cd3e92fbe26d0e81e7fbf9faf2aff63cff3e4c970b59072666146
7
+ data.tar.gz: 8fc36b576b67406ce212ad25399dfdcd31ffdd8e8b603431d2887da3b91acd722b20b1e9a79202a2604f42862d428c4fc1c1b8418c2b13325806e1673921537d
data/.travis.yml CHANGED
@@ -6,7 +6,7 @@ addons:
6
6
  postgresql: "9.3"
7
7
 
8
8
  before_script:
9
- - git clone https://gist.github.com/6179925.git -b v2.4 kalibro_install
9
+ - git clone https://gist.github.com/6179925.git -b v2.5 kalibro_install
10
10
  - pushd kalibro_install
11
11
  # Remove bugged libzmq3 package, see https://github.com/travis-ci/travis-ci/issues/982 and https://github.com/travis-ci/travis-ci/issues/1715 for details
12
12
  - sudo apt-get remove libzmq3
@@ -34,6 +34,10 @@ When(/^I ask to check if the given repository exists$/) do
34
34
  @response = KalibroClient::Entities::Processor::Repository.exists?(@repository.id)
35
35
  end
36
36
 
37
+ When(/^I ask for branches on a "(.*?)" repository with url "(.*?)"$/) do |scm_type, url|
38
+ @branch_list = KalibroClient::Entities::Processor::Repository.branches(url, scm_type)
39
+ end
40
+
37
41
  Then(/^I should get success$/) do
38
42
  expect(@response).to be_truthy
39
43
  end
@@ -69,3 +73,10 @@ Then(/^the repository should no longer exist$/) do
69
73
  expect(KalibroClient::Entities::Processor::Repository.exists?(@repository.id)).to be_falsey
70
74
  end
71
75
 
76
+ Then(/^the branch list should include "(.*?)"$/) do |name|
77
+ expect(@branch_list["branches"]).to include(name)
78
+ end
79
+
80
+ Then(/^it should return an error as reponse$/) do
81
+ expect(@branch_list["errors"]).to_not be_nil
82
+ end
@@ -19,7 +19,7 @@ module KalibroClient
19
19
  module Processor
20
20
  class Repository < KalibroClient::Entities::Processor::Base
21
21
 
22
- attr_accessor :id, :name, :description, :license, :period, :scm_type, :address, :kalibro_configuration_id, :project_id, :send_email, :code_directory
22
+ attr_accessor :id, :name, :description, :license, :period, :scm_type, :address, :kalibro_configuration_id, :project_id, :send_email, :code_directory, :branch
23
23
 
24
24
  def self.repository_types
25
25
  request('types', {}, :get)['types'].to_a
@@ -123,6 +123,10 @@ module KalibroClient
123
123
  return repositories
124
124
  end
125
125
 
126
+ def self.branches(url, scm_type)
127
+ request("/branches", {url: url, scm_type: scm_type})
128
+ end
129
+
126
130
  private
127
131
 
128
132
  def save_params
@@ -15,5 +15,5 @@
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
 
17
17
  module KalibroClient
18
- VERSION = "0.2.0"
18
+ VERSION = "0.3.0"
19
19
  end
@@ -386,5 +386,39 @@ describe KalibroClient::Entities::Processor::Repository do
386
386
  expect(response.state).to eq(processing.state)
387
387
  end
388
388
  end
389
+
390
+ describe 'branches' do
391
+ let(:branches) { ['branch1', 'branch2'] }
392
+ let(:url) { 'dummy-url' }
393
+ let(:scm_type) { 'GIT' }
394
+
395
+ context 'valid parameters' do
396
+ before :each do
397
+ KalibroClient::Entities::Processor::Repository.
398
+ expects(:request).
399
+ with("/branches", {url: url, scm_type: scm_type}).
400
+ returns({'branches' => branches})
401
+ end
402
+
403
+ it 'is expected to return an array of branch names' do
404
+ response = subject.class.branches(url, scm_type)
405
+ expect(response).to eq('branches' => branches)
406
+ end
407
+ end
408
+
409
+ context 'invalid parameters' do
410
+ before :each do
411
+ KalibroClient::Entities::Processor::Repository.
412
+ expects(:request).
413
+ with("/branches", {url: url, scm_type: scm_type}).
414
+ returns({'errors' => ['Error']})
415
+ end
416
+
417
+ it 'is expected to return an array of branch names' do
418
+ response = subject.class.branches(url, scm_type)
419
+ expect(response).to eq('errors' => ['Error'])
420
+ end
421
+ end
422
+ end
389
423
  end
390
424
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kalibro_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Quadros Miranda
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-05-29 00:00:00.000000000 Z
14
+ date: 2015-06-15 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler