kalibro_gatekeeper_client 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +2 -0
  3. data/.ruby-version +1 -1
  4. data/.travis.yml +8 -6
  5. data/features/step_definitions/base_tool_steps.rb +5 -5
  6. data/features/step_definitions/configuration_steps.rb +5 -5
  7. data/features/step_definitions/metric_configuration_steps.rb +5 -3
  8. data/features/step_definitions/metric_result_steps.rb +6 -6
  9. data/features/step_definitions/module_result_steps.rb +5 -5
  10. data/features/step_definitions/processing_steps.rb +6 -6
  11. data/features/step_definitions/project_steps.rb +4 -4
  12. data/features/step_definitions/range_steps.rb +11 -11
  13. data/features/step_definitions/reading_group_steps.rb +2 -2
  14. data/features/step_definitions/reading_steps.rb +6 -3
  15. data/features/step_definitions/repository_steps.rb +7 -7
  16. data/kalibro_gatekeeper_client.gemspec +2 -2
  17. data/lib/kalibro_gatekeeper_client/entities/metric.rb +5 -1
  18. data/lib/kalibro_gatekeeper_client/version.rb +1 -1
  19. data/spec/entities/base_tool_spec.rb +13 -13
  20. data/spec/entities/configuration_spec.rb +5 -5
  21. data/spec/entities/date_metric_result_spec.rb +5 -5
  22. data/spec/entities/date_module_result_spec.rb +5 -5
  23. data/spec/entities/metric_configuration_snapshot_spec.rb +10 -10
  24. data/spec/entities/metric_configuration_spec.rb +14 -14
  25. data/spec/entities/metric_result_spec.rb +16 -16
  26. data/spec/entities/metric_spec.rb +22 -4
  27. data/spec/entities/model_spec.rb +33 -33
  28. data/spec/entities/module_result_spec.rb +14 -14
  29. data/spec/entities/process_time_spec.rb +2 -2
  30. data/spec/entities/processing_spec.rb +23 -23
  31. data/spec/entities/project_spec.rb +5 -5
  32. data/spec/entities/range_snapshot_spec.rb +5 -5
  33. data/spec/entities/range_spec.rb +21 -21
  34. data/spec/entities/reading_group_spec.rb +5 -5
  35. data/spec/entities/reading_spec.rb +11 -11
  36. data/spec/entities/repository_observer_spec.rb +14 -14
  37. data/spec/entities/repository_spec.rb +12 -12
  38. data/spec/entities/stack_trace_element_spec.rb +1 -1
  39. data/spec/entities/throwable_spec.rb +4 -4
  40. data/spec/helpers/aggregation_options_spec.rb +1 -1
  41. data/spec/helpers/hash_converters_spec.rb +10 -10
  42. data/spec/helpers/xml_converters_spec.rb +5 -5
  43. data/spec/kalibro_entities_spec.rb +9 -9
  44. data/spec/spec_helper.rb +61 -6
  45. metadata +7 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d38c2656e3dee67a4f88b3269ff764f3070bbea
4
- data.tar.gz: 944b361d3fef5157ffe4c8c6895e43c02aec6c24
3
+ metadata.gz: 84a0ce9402375b7ad0808157427a4289530d0692
4
+ data.tar.gz: 70ab4e629016adbb2ded06b897f7be43e7fb8b2c
5
5
  SHA512:
6
- metadata.gz: f23504ffbf5cb432e37fc2b548b74ee99fa6712f71656df494c2e4f1daf378a5b8630a47e8ed02da5c7fdcc0dc3fb16a134dd977c0ad6c769a2c5d2494acf7f4
7
- data.tar.gz: 9c9da2ac04cd95040d03d0479fcefffaf436d2988bba5a5ae580fe3d170e5223e835e3ba0f52318223934461536fed679146afb4d5297f7ff1eac8fff9c752dc
6
+ metadata.gz: eb82d09dd8b19b9de2dec1dcfc2a88026cb422e02ad9d394cfd3f9716e29bcafa6cfd3839f23eacfaf0f1c87347d0901360f9c4c3271fa9a542b612dd9e7a7ec
7
+ data.tar.gz: c72ce98773cfa90616ab65466d9b3ae5cf7f7876cf01b631c2620c364d3d340dd167e98c1b3c985ece827684dc54c099d4c71ab3545c4339269c33a518957e62
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.1.1
1
+ ruby-2.1.2
data/.travis.yml CHANGED
@@ -1,14 +1,16 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.1
3
+ - 2.1.2
4
4
 
5
5
  before_script:
6
- - wget https://gist.github.com/rafamanzo/6179925/raw/77653bd6229e99d5251180a4488e2fa54d0cd4ac/db_bootstrap.sql
7
- - wget https://gist.github.com/rafamanzo/6179925/raw/a38c3b33af3b1784eece46450cca65503337e4b5/install.sh
8
- - chmod +x install.sh
9
- - ./install.sh
6
+ - git clone https://gist.github.com/0c4ad3b5700c6364abf1.git -b v1.0 kalibro_install
7
+ - pushd kalibro_install
8
+ # 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
9
+ - sudo apt-get remove libzmq3
10
+ - bash install.sh
11
+ - popd
10
12
  - cp features/support/kalibro_cucumber_helpers.yml.sample features/support/kalibro_cucumber_helpers.yml
11
- - git clone https://github.com/mezuro/kalibro_gatekeeper.git
13
+ - git clone https://github.com/mezuro/kalibro_gatekeeper.git -b v0.0.1 kalibro_gatekeeper
12
14
  - cd kalibro_gatekeeper
13
15
  - cp config/database.yml.sample config/database.yml
14
16
  - export BUNDLE_GEMFILE=$PWD/Gemfile
@@ -8,21 +8,21 @@ end
8
8
 
9
9
  When(/^I search base tool Avalio by name$/) do
10
10
  @is_error = false
11
- begin
11
+ begin
12
12
  KalibroGatekeeperClient::Entities::BaseTool.find_by_name("Avalio")
13
13
  rescue KalibroGatekeeperClient::Errors::RecordNotFound
14
- @is_error = true
14
+ @is_error = true
15
15
  end
16
16
  end
17
17
 
18
18
  Then(/^it should return Checkstyle and Analizo strings inside of an array$/) do
19
- (@base_tool_names.include?("Checkstyle") && @base_tool_names.include?("Analizo")).should be_true
19
+ expect(@base_tool_names.include?("Checkstyle") && @base_tool_names.include?("Analizo")).to be_truthy
20
20
  end
21
21
 
22
22
  Then(/^I should get Analizo base tool$/) do
23
- @result.name.should eq "Analizo"
23
+ expect(@result.name).to eq("Analizo")
24
24
  end
25
25
 
26
26
  Then(/^I should get an error$/) do
27
- @is_error.should be_true
27
+ expect(@is_error).to be_truthy
28
28
  end
@@ -6,14 +6,14 @@ When(/^I get all the configurations$/) do
6
6
  @all_configurations = KalibroGatekeeperClient::Entities::Configuration.all
7
7
  end
8
8
 
9
- Then(/^I should get a list with the given configuration$/) do
10
- @all_configurations.include?(@configuration).should be_true
11
- end
12
-
13
9
  When(/^I create the configuration with name "(.*?)"$/) do |name|
14
10
  @configuration = FactoryGirl.create(:configuration, {name: name, id: nil})
15
11
  end
16
12
 
13
+ Then(/^I should get a list with the given configuration$/) do
14
+ expect(@all_configurations.include?(@configuration)).to be_truthy
15
+ end
16
+
17
17
  Then(/^the configuration should exist$/) do
18
- KalibroGatekeeperClient::Entities::Configuration.exists?(@configuration.id).should be_true
18
+ expect(KalibroGatekeeperClient::Entities::Configuration.exists?(@configuration.id)).to be_truthy
19
19
  end
@@ -40,13 +40,15 @@ When(/^I request all metric configurations of the given configuration$/) do
40
40
  end
41
41
 
42
42
  Then(/^it should return the same metric configuration as the given one$/) do
43
- @found_metric_configuration == @metric_configuration
43
+ pending
44
+ expect(@found_metric_configuration).to eq(@metric_configuration)
44
45
  end
45
46
 
46
47
  Then(/^I should get a list of its metric configurations$/) do
47
- @metric_configurations == [@metric_configuration]
48
+ pending
49
+ expect(@metric_configurations).to eq([@metric_configuration])
48
50
  end
49
51
 
50
52
  Then(/^I should get an empty list of metric configurations$/) do
51
- @metric_configurations == []
53
+ expect(@metric_configurations).to eq([])
52
54
  end
@@ -14,16 +14,16 @@ When(/^I call the history of method with the metric name and the results root id
14
14
  end
15
15
 
16
16
  Then (/^I should get a Float list$/) do
17
- @response.should be_a(Array)
18
- @response.first.should be_a(Float)
17
+ expect(@response).to be_a(Array)
18
+ expect(@response.first).to be_a(Float)
19
19
  end
20
20
 
21
21
  Then(/^I should get a list of metric results$/) do
22
- @response.should be_a(Array)
23
- @response.first.should be_a(KalibroGatekeeperClient::Entities::MetricResult)
22
+ expect(@response).to be_a(Array)
23
+ expect(@response.first).to be_a(KalibroGatekeeperClient::Entities::MetricResult)
24
24
  end
25
25
 
26
26
  Then(/^I should get a list of date metric results$/) do
27
- @response.should be_a(Array)
28
- @response.first.should be_a(KalibroGatekeeperClient::Entities::DateMetricResult)
27
+ expect(@response).to be_a(Array)
28
+ expect(@response.first).to be_a(KalibroGatekeeperClient::Entities::DateMetricResult)
29
29
  end
@@ -16,15 +16,15 @@ When(/^I ask for an inexistent module result$/) do
16
16
  end
17
17
  end
18
18
 
19
- Then(/^I should get the given module result$/) do
20
- @found_module_result == @module_result
21
- end
22
-
23
19
  When(/^I ask for the children of the processing root module result$/) do
24
20
  @children = KalibroGatekeeperClient::Entities::ModuleResult.
25
21
  find(KalibroGatekeeperClient::Entities::Processing.processing_of(@repository.id).results_root_id)
26
22
  end
27
23
 
28
24
  Then(/^I should get a list with the children module results$/) do
29
- @children.should be_a(KalibroGatekeeperClient::Entities::ModuleResult)
25
+ expect(@children).to be_a(KalibroGatekeeperClient::Entities::ModuleResult)
26
+ end
27
+
28
+ Then(/^I should get the given module result$/) do
29
+ expect(@found_module_result).to eq(@module_result)
30
30
  end
@@ -67,25 +67,25 @@ When(/^I call the processing_with_date_of method for the given repository and ye
67
67
  end
68
68
 
69
69
  Then(/^I should get a Processing with state "(.*?)"$/) do |state|
70
- @response.state.should eq(state)
70
+ expect(@response.state).to eq(state)
71
71
  end
72
72
 
73
73
  Then(/^I should get nil$/) do
74
- @response.should be_nil
74
+ expect(@response).to be_nil
75
75
  end
76
76
 
77
77
  Then(/^I should get "(.*?)"$/) do |state|
78
- @response.should eq(state)
78
+ expect(@response).to eq(state)
79
79
  end
80
80
 
81
81
  Then(/^I should get false$/) do
82
- @response.should be_false
82
+ expect(@response).to be_falsey
83
83
  end
84
84
 
85
85
  Then(/^I should get true$/) do
86
- @response.should be_true
86
+ expect(@response).to be_truthy
87
87
  end
88
88
 
89
89
  Then(/^I should get a Processing$/) do
90
- @response.should be_a(KalibroGatekeeperClient::Entities::Processing)
90
+ expect(@response).to be_a(KalibroGatekeeperClient::Entities::Processing)
91
91
  end
@@ -32,17 +32,17 @@ When(/^I ask for all the projects$/) do
32
32
  end
33
33
 
34
34
  Then(/^the project should exist$/) do
35
- KalibroGatekeeperClient::Entities::Project.exists?(@project.id).should be_true
35
+ expect(KalibroGatekeeperClient::Entities::Project.exists?(@project.id)).to be_truthy
36
36
  end
37
37
 
38
38
  Then(/^it should return the same project as the given one$/) do
39
- @found_project == @project
39
+ expect(@found_project).to eq(@project)
40
40
  end
41
41
 
42
42
  Then(/^the project should not exist$/) do
43
- KalibroGatekeeperClient::Entities::Project.exists?(@found_project.id).should be_false
43
+ expect(KalibroGatekeeperClient::Entities::Project.exists?(@found_project.id)).to be_falsey
44
44
  end
45
45
 
46
46
  Then(/^I should get a list with the given project$/) do
47
- @all_projects.include?(@project)
47
+ expect(@all_projects).to include(@project)
48
48
  end
@@ -17,7 +17,7 @@ end
17
17
 
18
18
  When(/^I ask to save the given range with an inexistent metric configuration$/) do
19
19
  @range.metric_configuration_id = rand(Time.now.to_i)
20
- @range.save
20
+ @range.save
21
21
  end
22
22
 
23
23
  When(/^I ask ranges of the given metric configuration$/) do
@@ -27,8 +27,8 @@ end
27
27
  When(/^I try to save a range with an inexistent metric configuration$/) do
28
28
  @range = FactoryGirl.build(:range, {id: nil, reading_id: @reading.id})
29
29
  @range.metric_configuration_id = rand(Time.now.to_i)
30
- @range.save
31
- end
30
+ @range.save
31
+ end
32
32
 
33
33
  When(/^I ask for all the ranges$/) do
34
34
  @response = KalibroGatekeeperClient::Entities::Range.all
@@ -39,30 +39,30 @@ When(/^I search a range with the same id of the given range$/) do
39
39
  end
40
40
 
41
41
  Then(/^I should get an empty list$/) do
42
- @response.should eq([])
42
+ expect(@response).to eq([])
43
43
  end
44
44
 
45
45
  Then(/^I should not get an empty list$/) do
46
- @response.should_not eq([])
46
+ expect(@response).to_not eq([])
47
47
  end
48
48
 
49
49
  Then(/^I should get a list with the given range$/) do
50
- @response.size.should eq(1)
51
- @response.first.comments.should eq(@range.comments)
50
+ expect(@response.size).to eq(1)
51
+ expect(@response.first.comments).to eq(@range.comments)
52
52
  end
53
53
 
54
54
  Then(/^I should get an error in range kalibro errors attribute$/) do
55
- @range.kalibro_errors.should_not eq([])
55
+ expect(@range.kalibro_errors).to_not eq([])
56
56
  end
57
57
 
58
58
  Then(/^the id of the given range should be set$/) do
59
- @range.id.should_not eq(0)
59
+ expect(@range.id).to_not eq(0)
60
60
  end
61
61
 
62
62
  Then(/^it should return the same range as the given one$/) do
63
- @found_range == @range
63
+ expect(@found_range).to eq(@range)
64
64
  end
65
65
 
66
66
  Then(/^the range should exist$/) do
67
- KalibroGatekeeperClient::Entities::Range.exists?(@range.id)
67
+ expect(KalibroGatekeeperClient::Entities::Range.exists?(@range.id)).to be_truthy
68
68
  end
@@ -11,9 +11,9 @@ When(/^I call the reading_group_of method for the given MetricConfiguration$/) d
11
11
  end
12
12
 
13
13
  Then(/^I should get a list with the given reading group$/) do
14
- @all_reading_groups.include?(@reading_group)
14
+ expect(@all_reading_groups).to include(@reading_group)
15
15
  end
16
16
 
17
17
  Then(/^I should get the given RedingGroup$/) do
18
- @metric_configuration_reading_group.should eq(@reading_group)
18
+ expect(@metric_configuration_reading_group).to eq(@reading_group)
19
19
  end
@@ -27,13 +27,16 @@ 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
- @found_reading == @reading
30
+ pending
31
+ expect(@found_reading).to eq(@reading)
31
32
  end
32
33
 
33
34
  Then(/^I should get a list with the given reading$/) do
34
- @found_readings.first == @reading
35
+ pending
36
+ expect(@found_readings.first).to eq(@reading)
35
37
  end
36
38
 
37
39
  Then(/^the response should contain the given reading$/) do
38
- @all_readings.first == @reading
40
+ pending
41
+ expect(@all_readings.first).to eq(@reading)
39
42
  end
@@ -36,26 +36,26 @@ When(/^I ask to check if the given repository exists$/) do
36
36
  end
37
37
 
38
38
  Then(/^I should get success$/) do
39
- @response == true
39
+ expect(@response).to be_truthy
40
40
  end
41
41
 
42
42
  Then(/^I should get a list with the given repository$/) do
43
- @response.should include(@repository)
43
+ expect(@response).to include(@repository)
44
44
  end
45
45
 
46
46
  Then(/^I should get an array of types$/) do
47
- @repository_types.is_a?(Array)
48
- @repository_types.count >= 1
47
+ expect(@repository_types).to be_a(Array)
48
+ expect(@repository_types.count >= 1).to be_truthy
49
49
  end
50
50
 
51
51
  Then(/^I should get the given repository$/) do
52
- @response.should eq(@repository)
52
+ expect(@response).to eq(@repository)
53
53
  end
54
54
 
55
55
  Then(/^the response should contain the given repository$/) do
56
- @response.first.project_id.should eq(@project.id)
56
+ expect(@response.first.project_id).to eq(@project.id)
57
57
  end
58
58
 
59
59
  Then(/^the repositories should contain the project id$/) do
60
- @response.first.project_id.should eq(@project.id)
60
+ expect(@response.first.project_id).to eq(@project.id)
61
61
  end
@@ -37,9 +37,9 @@ Gem::Specification.new do |spec|
37
37
 
38
38
  spec.add_development_dependency "bundler", "~> 1.3"
39
39
  spec.add_development_dependency "rake"
40
- spec.add_development_dependency "rspec", "~> 2.14"
40
+ spec.add_development_dependency "rspec", "~> 3.0.0"
41
41
  spec.add_development_dependency "cucumber", "~> 1.3.14"
42
- spec.add_development_dependency "mocha", "~> 1.0.0"
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.4.0"
45
45
  spec.add_development_dependency 'coveralls'
@@ -1,7 +1,6 @@
1
1
  module KalibroGatekeeperClient
2
2
  module Entities
3
3
  class Metric < Model
4
-
5
4
  attr_accessor :name, :compound, :scope, :description, :script, :language
6
5
 
7
6
  def languages
@@ -16,6 +15,11 @@ module KalibroGatekeeperClient
16
15
  @language = self.class.to_objects_array value
17
16
  end
18
17
 
18
+ def compound
19
+ return true if @compound == true || @compound =~ (/(true|t|yes|y|1)$/i)
20
+ return false if @compound == false || @compound.empty? || @compound =~ (/(false|f|no|n|0)$/i)
21
+ raise ArgumentError.new("invalid value for Boolean: \"#{@compound}\"")
22
+ end
19
23
  end
20
24
  end
21
25
  end
@@ -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 = "0.1.0"
18
+ VERSION = "0.1.1"
19
19
  end
@@ -27,7 +27,7 @@ describe KalibroGatekeeperClient::Entities::BaseTool do
27
27
  end
28
28
 
29
29
  it 'should return empty array' do
30
- KalibroGatekeeperClient::Entities::BaseTool.all_names.should be_empty
30
+ expect(KalibroGatekeeperClient::Entities::BaseTool.all_names).to be_empty
31
31
  end
32
32
  end
33
33
 
@@ -45,9 +45,9 @@ describe KalibroGatekeeperClient::Entities::BaseTool do
45
45
  it 'should return the two elements' do
46
46
  names = KalibroGatekeeperClient::Entities::BaseTool.all_names
47
47
 
48
- names.size.should eq(2)
49
- names.first.should eq(JSON.parse(base_tool_hash.to_json))
50
- names.last.should eq(JSON.parse(another_base_tool_hash.to_json))
48
+ expect(names.size).to eq(2)
49
+ expect(names.first).to eq(JSON.parse(base_tool_hash.to_json))
50
+ expect(names.last).to eq(JSON.parse(another_base_tool_hash.to_json))
51
51
  end
52
52
  end
53
53
  end
@@ -62,7 +62,7 @@ describe KalibroGatekeeperClient::Entities::BaseTool do
62
62
  end
63
63
 
64
64
  it 'should return empty array' do
65
- KalibroGatekeeperClient::Entities::BaseTool.all_names.should be_empty
65
+ expect(KalibroGatekeeperClient::Entities::BaseTool.all_names).to be_empty
66
66
  end
67
67
  end
68
68
 
@@ -90,9 +90,9 @@ describe KalibroGatekeeperClient::Entities::BaseTool do
90
90
  it 'should return the two elements' do
91
91
  base_tools = KalibroGatekeeperClient::Entities::BaseTool.all
92
92
 
93
- base_tools.size.should eq(2)
94
- base_tools.first.name.should eq(base_tool.name)
95
- base_tools.last.name.should eq(another_base_tool.name)
93
+ expect(base_tools.size).to eq(2)
94
+ expect(base_tools.first.name).to eq(base_tool.name)
95
+ expect(base_tools.last.name).to eq(another_base_tool.name)
96
96
  end
97
97
  end
98
98
  end
@@ -123,7 +123,7 @@ describe KalibroGatekeeperClient::Entities::BaseTool do
123
123
  end
124
124
 
125
125
  it 'should return a base_tool' do
126
- KalibroGatekeeperClient::Entities::BaseTool.find_by_name(subject.name).name.should eq(subject.name)
126
+ expect(KalibroGatekeeperClient::Entities::BaseTool.find_by_name(subject.name).name).to eq(subject.name)
127
127
  end
128
128
  end
129
129
  end
@@ -141,14 +141,14 @@ describe KalibroGatekeeperClient::Entities::BaseTool do
141
141
  context 'supported_metric=' do
142
142
  it 'should set the value of the array of supported metrics' do
143
143
  subject.supported_metric = metric.to_hash
144
- subject.supported_metric.first.name.should eq(metric.name)
144
+ expect(subject.supported_metric.first.name).to eq(metric.name)
145
145
  end
146
146
  end
147
147
 
148
148
  context 'supported_metrics' do
149
149
  it 'should return the array of the supported metrics' do
150
150
  subject.supported_metric = metric.to_hash
151
- subject.supported_metrics.first.name.should eq(metric.name)
151
+ expect(subject.supported_metrics.first.name).to eq(metric.name)
152
152
  end
153
153
  end
154
154
  end
@@ -158,11 +158,11 @@ describe KalibroGatekeeperClient::Entities::BaseTool do
158
158
  let(:metric) { subject.supported_metrics.first }
159
159
 
160
160
  it 'should return nil with an inexistent name' do
161
- subject.metric("fake name").should be_nil
161
+ expect(subject.metric("fake name")).to be_nil
162
162
  end
163
163
 
164
164
  it 'should return a metric with an existent name' do
165
- subject.metric(metric.name).name.should eq(metric.name)
165
+ expect(subject.metric(metric.name).name).to eq(metric.name)
166
166
  end
167
167
  end
168
168
  end