kalibro_gatekeeper_client 1.0.0.rc1 → 1.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2608c0043b948d427c8295b29c89a9c1696359af
4
- data.tar.gz: b7fbddd6d727b1e7a3729b3c4b0747fb9e759c0c
3
+ metadata.gz: 949d2afc43f14ed6cae9ab66b710a27305cd3210
4
+ data.tar.gz: 661a875588669e291ca48e35b83ad765b345a00b
5
5
  SHA512:
6
- metadata.gz: 1d8b5ccf430eb37250245f3d6c5a0665d094b2cd6a323d3f05736e1935a2ab34db357ab2f800facda853b30ce861ce58a55ce68614ccd3577ef5ef5708681173
7
- data.tar.gz: 4032a1103cb3b26f2e9b7a0d3a8eb38ca9eba02c57ebe380c368c948cce7e9821a7fbf409bd03b744ce1995cbf599129fec6d21364aa381c80ebbc445808dbfc
6
+ metadata.gz: 0f06455e7c3b1011a031a7c6f5c003eac519d6cb0414bc2400ddf27dfcc3a6b81e0c4b8cfb8ea92c130c4fddbeda531dd6596ee512f9dd5599ddc91a3eea7b9e
7
+ data.tar.gz: 68730d8631441a827badd7b8ce203d582860182f85758bef5969072dce8e729956476ad354464e33ff4944aa26c4e4a674b02484acf34eb2ca6d896802a8a916
@@ -8,6 +8,6 @@ Feature: Reading listing
8
8
  Given I have a reading group with name "Kalibro"
9
9
  And the given reading group has the following readings:
10
10
  | label | grade | color |
11
- | "Awesome" | 10 | 3333FF |
11
+ | "Awesome" | 10 | 3333ff |
12
12
  When I ask for all the readings
13
13
  Then the response should contain the given reading
@@ -8,6 +8,6 @@ Feature: Reading listing
8
8
  Given I have a reading group with name "RG"
9
9
  And the given reading group has the following readings:
10
10
  | label | grade | color |
11
- | "Awesome" | 10 | 3333FF |
11
+ | "Awesome" | 10 | 3333ff |
12
12
  When I ask to check if the given reading exists
13
13
  Then I should get true
@@ -1,4 +1,4 @@
1
- Feature: Find
1
+ Feature: Readings Of
2
2
  In order to be able to have readings
3
3
  As an developer
4
4
  I want to get the readings of the given reading group
@@ -42,12 +42,10 @@ When(/^I request all metric configurations of the given configuration$/) do
42
42
  end
43
43
 
44
44
  Then(/^it should return the same metric configuration as the given one$/) do
45
- pending
46
45
  expect(@found_metric_configuration).to eq(@metric_configuration)
47
46
  end
48
47
 
49
48
  Then(/^I should get a list of its metric configurations$/) do
50
- pending
51
49
  expect(@metric_configurations).to eq([@metric_configuration])
52
50
  end
53
51
 
@@ -27,16 +27,13 @@ When(/^I ask to check if the given reading exists$/) do
27
27
  end
28
28
 
29
29
  Then(/^I should get the given reading$/) do
30
- pending
31
30
  expect(@found_reading).to eq(@reading)
32
31
  end
33
32
 
34
33
  Then(/^I should get a list with the given reading$/) do
35
- pending
36
34
  expect(@found_readings.first).to eq(@reading)
37
35
  end
38
36
 
39
37
  Then(/^the response should contain the given reading$/) do
40
- pending
41
38
  expect(@all_readings.first).to eq(@reading)
42
39
  end
@@ -19,18 +19,18 @@ require "kalibro_gatekeeper_client/entities/model"
19
19
  module KalibroGatekeeperClient
20
20
  module Entities
21
21
  class MetricCollector < Model
22
- attr_accessor :name, :description, :collector_class_name, :supported_metric, :wanted_metrics, :processing
22
+ attr_accessor :name, :description, :supported_metrics, :wanted_metrics, :processing
23
23
 
24
- def supported_metric=(value)
25
- @supported_metric = KalibroGatekeeperClient::Entities::Metric.to_objects_array value
26
- end
27
-
28
- def supported_metrics
29
- @supported_metric
24
+ def supported_metrics=(value)
25
+ @supported_metrics = {}
26
+ value.each do |code, metric|
27
+ @supported_metrics[code] = KalibroGatekeeperClient::Entities::Metric.new metric
28
+ end
30
29
  end
31
30
 
32
31
  def metric(name)
33
- supported_metrics.find {|metric| metric.name == name}
32
+ metric = self.supported_metrics.find {|code, metric| metric.name == name}
33
+ metric.nil? ? nil : metric.last
34
34
  end
35
35
 
36
36
  def self.find_by_name(metric_collector_name)
@@ -47,9 +47,9 @@ module KalibroGatekeeperClient
47
47
  end
48
48
 
49
49
  def self.all
50
- metric_collectors = all_names
51
- metric_collectors.map{ |name| find_by_name(name) }
50
+ metric_collectors_names = all_names
51
+ metric_collectors_names.map{ |name| find_by_name(name) }
52
52
  end
53
53
  end
54
54
  end
55
- end
55
+ end
@@ -28,6 +28,10 @@ module KalibroGatekeeperClient
28
28
  @grade = value.to_f
29
29
  end
30
30
 
31
+ def group_id=(value)
32
+ @group_id = value.to_i
33
+ end
34
+
31
35
  def self.find(id)
32
36
  response = request('get', {id: id})
33
37
  raise KalibroGatekeeperClient::Errors::RecordNotFound unless response['error'].nil?
@@ -15,5 +15,5 @@
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
 
17
17
  module KalibroGatekeeperClient
18
- VERSION = "1.0.0.rc1"
18
+ VERSION = "1.0.0.rc2"
19
19
  end
@@ -67,8 +67,8 @@ describe KalibroGatekeeperClient::Entities::MetricCollector do
67
67
  end
68
68
 
69
69
  context 'with many metric collectors' do
70
- let(:metric_collector) { FactoryGirl.build(:metric_collector) }
71
- let(:another_metric_collector) { FactoryGirl.build(:another_metric_collector) }
70
+ let!(:metric_collector) { FactoryGirl.build(:metric_collector) }
71
+ let!(:another_metric_collector) { FactoryGirl.build(:another_metric_collector) }
72
72
 
73
73
  before :each do
74
74
  KalibroGatekeeperClient::Entities::MetricCollector.
@@ -77,14 +77,14 @@ describe KalibroGatekeeperClient::Entities::MetricCollector do
77
77
  returns({'metric_collector_names' => [metric_collector.name, another_metric_collector.name]}.to_json)
78
78
 
79
79
  KalibroGatekeeperClient::Entities::MetricCollector.
80
- expects(:request).
81
- with(:get, {name: metric_collector.name}).
82
- returns(metric_collector.to_hash)
80
+ expects(:find_by_name).
81
+ with(metric_collector.name).
82
+ returns(metric_collector)
83
83
 
84
84
  KalibroGatekeeperClient::Entities::MetricCollector.
85
- expects(:request).
86
- with(:get, {name: another_metric_collector.name}).
87
- returns(another_metric_collector.to_hash)
85
+ expects(:find_by_name).
86
+ with(another_metric_collector.name).
87
+ returns(another_metric_collector)
88
88
  end
89
89
 
90
90
  it 'should return the two elements' do
@@ -115,11 +115,15 @@ describe KalibroGatekeeperClient::Entities::MetricCollector do
115
115
  end
116
116
 
117
117
  context 'with an existent name' do
118
+ #FIXME: Mocha is creating the expectations with strings, but FactoryGirl returns everything with sybols and integers
119
+ let!(:params) { Hash[FactoryGirl.attributes_for(:metric_collector).map { |k,v| [k.to_s, v.to_s]}] }
120
+ let(:metric_params) { { "total_abstract_classes" => Hash[FactoryGirl.attributes_for(:metric).map { |k,v| if v.is_a?(Array) then [k.to_s, v] else [k.to_s, v.to_s] end}] } }
118
121
  before :each do
122
+ params["supported_metrics"] = metric_params
119
123
  KalibroGatekeeperClient::Entities::MetricCollector.
120
124
  expects(:request).
121
125
  with(:get,{name: subject.name}).
122
- returns(subject.to_hash)
126
+ returns(params)
123
127
  end
124
128
 
125
129
  it 'should return a metric_collector' do
@@ -128,34 +132,22 @@ describe KalibroGatekeeperClient::Entities::MetricCollector do
128
132
  end
129
133
  end
130
134
 
131
- describe 'Supported Metric' do
132
- let(:metric) { FactoryGirl.build(:metric) }
133
-
134
- before :each do
135
- KalibroGatekeeperClient::Entities::Metric.
136
- expects(:to_objects_array).at_least_once.
137
- with(metric.to_hash).
138
- returns([metric])
139
- end
135
+ describe 'Supported Metrics' do
136
+ let(:code_and_metric) { { "total_abstract_classes" => FactoryGirl.build(:metric) } }
137
+ #FIXME: Mocha is creating the expectations with strings, but FactoryGirl returns everything with sybols and integers
138
+ let(:code_and_metric_parameter) { { "total_abstract_classes" => Hash[FactoryGirl.attributes_for(:metric).map { |k,v| if v.is_a?(Array) then [k.to_s, v] else [k.to_s, v.to_s] end}] } }
140
139
 
141
- context 'supported_metric=' do
140
+ context 'supported_metrics acessors' do
142
141
  it 'should set the value of the array of supported metrics' do
143
- subject.supported_metric = metric.to_hash
144
- expect(subject.supported_metric.first.name).to eq(metric.name)
145
- end
146
- end
147
-
148
- context 'supported_metrics' do
149
- it 'should return the array of the supported metrics' do
150
- subject.supported_metric = metric.to_hash
151
- expect(subject.supported_metrics.first.name).to eq(metric.name)
142
+ subject.supported_metrics = code_and_metric_parameter
143
+ expect(subject.supported_metrics).to eq(code_and_metric)
152
144
  end
153
145
  end
154
146
  end
155
147
 
156
148
  describe 'metric' do
157
149
  subject { FactoryGirl.build(:metric_collector) }
158
- let(:metric) { subject.supported_metrics.first }
150
+ let(:metric) { subject.supported_metrics["loc"] }
159
151
 
160
152
  it 'should return nil with an inexistent name' do
161
153
  expect(subject.metric("fake name")).to be_nil
@@ -165,4 +157,4 @@ describe KalibroGatekeeperClient::Entities::MetricCollector do
165
157
  expect(subject.metric(metric.name).name).to eq(metric.name)
166
158
  end
167
159
  end
168
- end
160
+ end
@@ -18,8 +18,7 @@ FactoryGirl.define do
18
18
  factory :metric_collector, class: KalibroGatekeeperClient::Entities::MetricCollector do
19
19
  name "Analizo"
20
20
  description "Analizo is a suite of source code analysis tools."
21
- collector_class_name "org.analizo.AnalizoMetricCollector"
22
- supported_metric { [FactoryGirl.build(:metric), FactoryGirl.build(:metric)] }
21
+ supported_metrics { { "total_abstract_classes" => FactoryGirl.build(:metric).to_hash, "loc" => FactoryGirl.build(:loc).to_hash } }
23
22
 
24
23
  trait :another_metric_collector do
25
24
  name "Avalio"
@@ -28,4 +27,4 @@ FactoryGirl.define do
28
27
 
29
28
  factory :another_metric_collector, traits: [:another_metric_collector]
30
29
  end
31
- end
30
+ end
@@ -17,19 +17,19 @@
17
17
  FactoryGirl.define do
18
18
  factory :metric, class: KalibroGatekeeperClient::Entities::Metric do
19
19
  name "Total Abstract Classes"
20
- compound false
20
+ compound "false"
21
21
  scope "SOFTWARE"
22
- description nil
22
+ description ""
23
23
  script ""
24
24
  language ["C", "CPP", "JAVA"]
25
25
  end
26
26
 
27
27
  factory :loc, class: KalibroGatekeeperClient::Entities::Metric do
28
28
  name "Lines of Code"
29
- compound false
29
+ compound "false"
30
30
  scope "CLASS"
31
- description nil
31
+ description ""
32
32
  script ""
33
33
  language ["C", "CPP", "JAVA"]
34
34
  end
35
- end
35
+ end
@@ -5,7 +5,7 @@
5
5
  # it under the terms of the GNU General Public License as published by
6
6
  # the Free Software Foundation, either version 3 of the License, or
7
7
  # (at your option) any later version.
8
- #
8
+ #
9
9
  # This program is distributed in the hope that it will be useful,
10
10
  # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
11
  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -19,5 +19,5 @@ FactoryGirl.define do
19
19
  id 1
20
20
  name "Mussum"
21
21
  description "Cacildis!"
22
- end
22
+ end
23
23
  end
@@ -5,7 +5,7 @@
5
5
  # it under the terms of the GNU General Public License as published by
6
6
  # the Free Software Foundation, either version 3 of the License, or
7
7
  # (at your option) any later version.
8
- #
8
+ #
9
9
  # This program is distributed in the hope that it will be useful,
10
10
  # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
11
  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -18,8 +18,8 @@ FactoryGirl.define do
18
18
  factory :reading, class: KalibroGatekeeperClient::Entities::Reading do
19
19
  id 42
20
20
  label "Good"
21
- grade 10.5
22
- color "33DD33"
21
+ grade 10.5
22
+ color "33dd33"
23
23
  group_id 31
24
- end
24
+ end
25
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kalibro_gatekeeper_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc1
4
+ version: 1.0.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Diego Araújo Martinez
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-09-09 00:00:00.000000000 Z
14
+ date: 2014-09-11 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler