kalibro_client 1.3.0 → 1.4.0

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: 389fd917fcbbe1e5765f5f848cad583ecfaedc28
4
- data.tar.gz: 42702af62588e9744a9895ccb2981fe7021f6278
3
+ metadata.gz: 4f36ebf03fced2783543cfb04e96c2f28c31d953
4
+ data.tar.gz: acccf00c1ef7afae8f135289f8975151bd2f077d
5
5
  SHA512:
6
- metadata.gz: 3e8e4a35f7884b9ebcd87cd12bf7db909a631e5b59f33b6223e7b0ef8254c9d007f039e7bb918c5fb3da4cd6be5436ddd126a608b35a012a5fddcee0c7d7309c
7
- data.tar.gz: bacc3234fcb2db12348c837fa32606a168a6c1d7296e7b915c0db392a2703c80f8ff65efc4d2c2784860ddb2b1b88083e520144ca1de84a95c0c56b9fd6d04fc
6
+ metadata.gz: 8529ac817e6cbdf7a5568a338f1447d214e9b272e86d220641d571c504839d9255c12ffd4a9ce8de839bc68e8f0008ef9b01add6dd6e165d70b7549db8332bb6
7
+ data.tar.gz: b511bc8b7fdbb9316741ffce48384ada061b188cee753e2de59c5b456472a8bfd8a7abc36d48330c3f19ab2c5ea212b349fda904b33709fcca86a4ad7209c0f0
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.2.2
1
+ ruby-2.2.3
@@ -38,7 +38,7 @@ Gem::Specification.new do |spec|
38
38
  spec.add_development_dependency "bundler", "~> 1.3"
39
39
  spec.add_development_dependency "rake"
40
40
  spec.add_development_dependency "rspec", "~> 3.3.0"
41
- spec.add_development_dependency "cucumber", "~> 1.3.14"
41
+ spec.add_development_dependency "cucumber", "~> 2.0.2"
42
42
  spec.add_development_dependency "mocha", "~> 1.1.0"
43
43
  spec.add_development_dependency "simplecov"
44
44
  spec.add_development_dependency "factory_girl", "~> 4.5.0"
@@ -46,5 +46,5 @@ Gem::Specification.new do |spec|
46
46
  spec.add_development_dependency "ruby-prof"
47
47
 
48
48
  spec.add_dependency "activesupport", ">= 2.2.1" #version in which underscore was introduced
49
- spec.add_dependency "faraday_middleware", "~> 0.9.0"
49
+ spec.add_dependency "faraday_middleware", "~> 0.10.0"
50
50
  end
@@ -14,12 +14,15 @@
14
14
  # You should have received a copy of the GNU General Public License
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
 
17
+ require 'kalibro_client/helpers/range_methods'
18
+
17
19
  module KalibroClient
18
20
  module Entities
19
21
  module Configurations
20
22
  class KalibroRange < KalibroClient::Entities::Configurations::Base
21
-
22
- attr_accessor :id, :beginning, :end, :reading_id, :comments, :metric_configuration_id
23
+ attr_accessor :id, :reading_id, :comments, :metric_configuration_id
24
+ attr_reader :beginning, :end
25
+ include RangeMethods
23
26
 
24
27
  def id=(value)
25
28
  @id = value.to_i
@@ -14,19 +14,15 @@
14
14
  # You should have received a copy of the GNU General Public License
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
 
17
+ require 'kalibro_client/helpers/range_methods'
18
+
17
19
  module KalibroClient
18
20
  module Entities
19
21
  module Configurations
20
22
  class RangeSnapshot < KalibroClient::Entities::Configurations::Base
21
- attr_accessor :beginning, :end, :label, :grade, :color, :comments
22
-
23
- def beginning=(value)
24
- @beginning = ((value == "-INF") ? -1.0/0 : value.to_f)
25
- end
26
-
27
- def end=(value)
28
- @end = ((value == "INF") ? 1.0/0 : value.to_f)
29
- end
23
+ attr_accessor :label, :grade, :color, :comments
24
+ attr_reader :beginning, :end
25
+ include RangeMethods
30
26
 
31
27
  def grade=(value)
32
28
  @grade = value.to_f
@@ -0,0 +1,14 @@
1
+ module RangeMethods
2
+ def range
3
+ @range ||= Range.new(Float(beginning), Float(self.end), exclude_end: true)
4
+ end
5
+
6
+ def beginning=(value)
7
+ @beginning = (value == "-INF") ? -Float::INFINITY : value
8
+ end
9
+
10
+ def end=(value)
11
+ @end = (value == "INF") ? Float::INFINITY : value
12
+ end
13
+ end
14
+
@@ -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 = "1.3.0"
18
+ VERSION = "1.4.0"
19
19
  end
@@ -160,9 +160,26 @@ describe KalibroClient::Entities::Configurations::KalibroRange do
160
160
  returns("errors" => nil)
161
161
  end
162
162
 
163
- it 'should make a request to updatethe model and return true without errors' do
163
+ it 'should make a request to update the model and return true without errors' do
164
164
  expect(subject.update).to be(true)
165
165
  expect(subject.kalibro_errors).to be_empty
166
166
  end
167
167
  end
168
+
169
+ describe 'range' do
170
+ context 'with finite beginning and end' do
171
+ subject { FactoryGirl.build(:range) }
172
+
173
+ it 'should create a Range object using the boundaries' do
174
+ expect(subject.range).to eq(Range.new(subject.beginning.to_f, subject.end.to_f, exlude_end: true))
175
+ end
176
+ end
177
+ context 'with infinite beginning and/or end' do
178
+ subject { FactoryGirl.build(:range, beginning: "-INF", end: "INF") }
179
+
180
+ it 'should create a Range object using the boundaries' do
181
+ expect(subject.range).to eq(Range.new(-Float::INFINITY, Float::INFINITY, exlude_end: true))
182
+ end
183
+ end
184
+ end
168
185
  end
@@ -0,0 +1,76 @@
1
+ # This file is part of KalibroClient
2
+ # Copyright (C) 2013 it's respectives authors (please see the AUTHORS file)
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ require 'spec_helper'
18
+ require 'kalibro_client/helpers/range_methods'
19
+
20
+ class TestRangeMethods
21
+ attr_reader :beginning, :end
22
+
23
+ include RangeMethods
24
+ end
25
+
26
+ describe TestRangeMethods do
27
+ subject { TestRangeMethods.new }
28
+
29
+ describe 'range' do
30
+ before do
31
+ subject.beginning = 0
32
+ subject.end = 10
33
+ end
34
+
35
+ it 'is expected to instantiate a Range' do
36
+ instantiated_range = subject.range
37
+
38
+ expect(instantiated_range).to be_a(Range)
39
+ expect(instantiated_range === 10).to be_falsey
40
+ expect(instantiated_range === 0).to be_truthy
41
+ expect(instantiated_range === Float::INFINITY).to be_falsey
42
+ end
43
+ end
44
+
45
+ describe 'beginning=' do
46
+ context 'with a finite value' do
47
+ it 'is expected to set the beginning attribute to the value' do
48
+ subject.beginning = 10
49
+ expect(subject.beginning).to eq(10)
50
+ end
51
+ end
52
+
53
+ context 'with a string representing a negative infinity value' do
54
+ it 'is expected to set the beginning attribute to a negative infinity value' do
55
+ subject.beginning = "-INF"
56
+ expect(subject.beginning).to eq(-Float::INFINITY)
57
+ end
58
+ end
59
+ end
60
+
61
+ describe 'end=' do
62
+ context 'with a finite value' do
63
+ it 'is expected to set the end attribute to the value' do
64
+ subject.end = 10
65
+ expect(subject.end).to eq(10)
66
+ end
67
+ end
68
+
69
+ context 'with a string representing a positive infinity value' do
70
+ it 'is expected to set the end attribute to a positive infinity value' do
71
+ subject.end = "INF"
72
+ expect(subject.end).to eq(Float::INFINITY)
73
+ end
74
+ end
75
+ end
76
+ 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: 1.3.0
4
+ version: 1.4.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-08-28 00:00:00.000000000 Z
14
+ date: 2015-09-11 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -61,14 +61,14 @@ dependencies:
61
61
  requirements:
62
62
  - - "~>"
63
63
  - !ruby/object:Gem::Version
64
- version: 1.3.14
64
+ version: 2.0.2
65
65
  type: :development
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
69
  - - "~>"
70
70
  - !ruby/object:Gem::Version
71
- version: 1.3.14
71
+ version: 2.0.2
72
72
  - !ruby/object:Gem::Dependency
73
73
  name: mocha
74
74
  requirement: !ruby/object:Gem::Requirement
@@ -159,14 +159,14 @@ dependencies:
159
159
  requirements:
160
160
  - - "~>"
161
161
  - !ruby/object:Gem::Version
162
- version: 0.9.0
162
+ version: 0.10.0
163
163
  type: :runtime
164
164
  prerelease: false
165
165
  version_requirements: !ruby/object:Gem::Requirement
166
166
  requirements:
167
167
  - - "~>"
168
168
  - !ruby/object:Gem::Version
169
- version: 0.9.0
169
+ version: 0.10.0
170
170
  description: KalibroClient is a Ruby gem intended to be an interface for Ruby applications
171
171
  who want to use the open source code analysis webservice Kalibro.
172
172
  email:
@@ -296,6 +296,7 @@ files:
296
296
  - lib/kalibro_client/helpers/aggregation_options.rb
297
297
  - lib/kalibro_client/helpers/date_attributes.rb
298
298
  - lib/kalibro_client/helpers/hash_converters.rb
299
+ - lib/kalibro_client/helpers/range_methods.rb
299
300
  - lib/kalibro_client/helpers/request_methods.rb
300
301
  - lib/kalibro_client/helpers/xml_converters.rb
301
302
  - lib/kalibro_client/kalibro_cucumber_helpers.rb
@@ -354,6 +355,7 @@ files:
354
355
  - spec/helpers/aggregation_options_spec.rb
355
356
  - spec/helpers/date_attributes_spec.rb
356
357
  - spec/helpers/hash_converters_spec.rb
358
+ - spec/helpers/range_methods_spec.rb
357
359
  - spec/helpers/xml_converters_spec.rb
358
360
  - spec/kalibro_entities_spec.rb
359
361
  - spec/savon/fixtures/config.yml
@@ -381,7 +383,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
381
383
  version: '0'
382
384
  requirements: []
383
385
  rubyforge_project:
384
- rubygems_version: 2.4.5.1
386
+ rubygems_version: 2.4.8
385
387
  signing_key:
386
388
  specification_version: 4
387
389
  summary: KalibroClient is a communication interface with the KalibroProcessor and
@@ -506,6 +508,7 @@ test_files:
506
508
  - spec/helpers/aggregation_options_spec.rb
507
509
  - spec/helpers/date_attributes_spec.rb
508
510
  - spec/helpers/hash_converters_spec.rb
511
+ - spec/helpers/range_methods_spec.rb
509
512
  - spec/helpers/xml_converters_spec.rb
510
513
  - spec/kalibro_entities_spec.rb
511
514
  - spec/savon/fixtures/config.yml