kalibro_client 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.rspec +2 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/.travis.yml +27 -0
  7. data/AUTHORS +4 -0
  8. data/COPYING +674 -0
  9. data/COPYING.LESSER +165 -0
  10. data/Gemfile +4 -0
  11. data/README.md +77 -0
  12. data/Rakefile +6 -0
  13. data/cucumber.yml +1 -0
  14. data/features/kalibro_configuration/all.feature +10 -0
  15. data/features/kalibro_configuration/creation.feature +9 -0
  16. data/features/kalibro_configuration/destroy.feature +10 -0
  17. data/features/kalibro_configuration/metric_configurations.feature +12 -0
  18. data/features/metric_collector_details/all_names.feature +8 -0
  19. data/features/metric_collector_details/find_by_name.feature +12 -0
  20. data/features/metric_configuration/creation.feature +11 -0
  21. data/features/metric_configuration/destroy.feature +12 -0
  22. data/features/metric_configuration/find.feature +18 -0
  23. data/features/metric_configuration/metric_configurations_of.feature +18 -0
  24. data/features/metric_result/descendant_values.feature +19 -0
  25. data/features/metric_result/history_of.feature +20 -0
  26. data/features/metric_result/metric_results_of.feature +20 -0
  27. data/features/module_result/children.feature +19 -0
  28. data/features/module_result/find.feature +22 -0
  29. data/features/module_result/history_of.feature +19 -0
  30. data/features/processing/first_processing_after.feature +18 -0
  31. data/features/processing/first_processing_of.feature +18 -0
  32. data/features/processing/has_processing.feature +18 -0
  33. data/features/processing/has_processing_after.feature +18 -0
  34. data/features/processing/has_processing_before.feature +18 -0
  35. data/features/processing/has_ready_processing.feature +18 -0
  36. data/features/processing/last_processing_before.feature +18 -0
  37. data/features/processing/last_processing_of.feature +18 -0
  38. data/features/processing/last_processing_state_of.feature +18 -0
  39. data/features/processing/last_ready_processing_of.feature +19 -0
  40. data/features/processing/processing_of.feature +32 -0
  41. data/features/processing/processing_with_date_of.feature +32 -0
  42. data/features/project/all.feature +10 -0
  43. data/features/project/creation.feature +9 -0
  44. data/features/project/destroy.feature +10 -0
  45. data/features/project/exists.feature +9 -0
  46. data/features/project/find.feature +10 -0
  47. data/features/range/destroy.feature +14 -0
  48. data/features/range/exists.feature +13 -0
  49. data/features/range/find.feature +14 -0
  50. data/features/range/ranges_of.feature +22 -0
  51. data/features/range/save.feature +14 -0
  52. data/features/reading/destroy.feature +13 -0
  53. data/features/reading/exists.feature +13 -0
  54. data/features/reading/find.feature +11 -0
  55. data/features/reading/readings_of.feature +11 -0
  56. data/features/reading_group/all.feature +10 -0
  57. data/features/reading_group/creation.feature +9 -0
  58. data/features/reading_group/destroy.feature +11 -0
  59. data/features/repository/all.feature +14 -0
  60. data/features/repository/cancel_processing.feature +14 -0
  61. data/features/repository/destroy.feature +14 -0
  62. data/features/repository/exists.feature +14 -0
  63. data/features/repository/find.feature +14 -0
  64. data/features/repository/of.feature +15 -0
  65. data/features/repository/process.feature +16 -0
  66. data/features/repository/types.feature +8 -0
  67. data/features/step_definitions/configuration_steps.rb +40 -0
  68. data/features/step_definitions/metric_collector_details_steps.rb +28 -0
  69. data/features/step_definitions/metric_configuration_steps.rb +61 -0
  70. data/features/step_definitions/metric_result_steps.rb +33 -0
  71. data/features/step_definitions/metric_steps.rb +3 -0
  72. data/features/step_definitions/module_result_steps.rb +46 -0
  73. data/features/step_definitions/processing_steps.rb +95 -0
  74. data/features/step_definitions/project_steps.rb +48 -0
  75. data/features/step_definitions/range_steps.rb +72 -0
  76. data/features/step_definitions/reading_group_steps.rb +36 -0
  77. data/features/step_definitions/reading_steps.rb +47 -0
  78. data/features/step_definitions/repository_steps.rb +71 -0
  79. data/features/support/env.rb +25 -0
  80. data/features/support/kalibro_cucumber_helpers.yml.sample +3 -0
  81. data/kalibro_client.gemspec +49 -0
  82. data/lib/kalibro_client.rb +62 -0
  83. data/lib/kalibro_client/entities.rb +40 -0
  84. data/lib/kalibro_client/entities/base.rb +196 -0
  85. data/lib/kalibro_client/entities/configurations/base.rb +13 -0
  86. data/lib/kalibro_client/entities/configurations/kalibro_configuration.rb +37 -0
  87. data/lib/kalibro_client/entities/configurations/kalibro_range.rb +77 -0
  88. data/lib/kalibro_client/entities/configurations/metric_configuration.rb +93 -0
  89. data/lib/kalibro_client/entities/configurations/range_snapshot.rb +37 -0
  90. data/lib/kalibro_client/entities/configurations/reading.rb +56 -0
  91. data/lib/kalibro_client/entities/configurations/reading_group.rb +34 -0
  92. data/lib/kalibro_client/entities/miscellaneous/base.rb +57 -0
  93. data/lib/kalibro_client/entities/miscellaneous/compound_metric.rb +21 -0
  94. data/lib/kalibro_client/entities/miscellaneous/date_metric_result.rb +14 -0
  95. data/lib/kalibro_client/entities/miscellaneous/date_module_result.rb +18 -0
  96. data/lib/kalibro_client/entities/miscellaneous/granularity.rb +54 -0
  97. data/lib/kalibro_client/entities/miscellaneous/metric.rb +19 -0
  98. data/lib/kalibro_client/entities/miscellaneous/native_metric.rb +24 -0
  99. data/lib/kalibro_client/entities/processor/base.rb +16 -0
  100. data/lib/kalibro_client/entities/processor/kalibro_module.rb +27 -0
  101. data/lib/kalibro_client/entities/processor/metric_collector_details.rb +53 -0
  102. data/lib/kalibro_client/entities/processor/metric_result.rb +79 -0
  103. data/lib/kalibro_client/entities/processor/module_result.rb +82 -0
  104. data/lib/kalibro_client/entities/processor/process_time.rb +31 -0
  105. data/lib/kalibro_client/entities/processor/processing.rb +109 -0
  106. data/lib/kalibro_client/entities/processor/project.rb +34 -0
  107. data/lib/kalibro_client/entities/processor/repository.rb +75 -0
  108. data/lib/kalibro_client/errors.rb +18 -0
  109. data/lib/kalibro_client/errors/record_not_found.rb +22 -0
  110. data/lib/kalibro_client/errors/standard.rb +24 -0
  111. data/lib/kalibro_client/helpers/aggregation_options.rb +25 -0
  112. data/lib/kalibro_client/helpers/hash_converters.rb +48 -0
  113. data/lib/kalibro_client/helpers/request_methods.rb +55 -0
  114. data/lib/kalibro_client/helpers/xml_converters.rb +20 -0
  115. data/lib/kalibro_client/kalibro_cucumber_helpers.rb +60 -0
  116. data/lib/kalibro_client/kalibro_cucumber_helpers/configuration.rb +30 -0
  117. data/lib/kalibro_client/kalibro_cucumber_helpers/hooks.rb +25 -0
  118. data/lib/kalibro_client/version.rb +19 -0
  119. data/lib/rake/test_task.rb +57 -0
  120. data/spec/entities/base_spec.rb +313 -0
  121. data/spec/entities/configurations/base_spec.rb +26 -0
  122. data/spec/entities/configurations/kalibro_configuration_spec.rb +91 -0
  123. data/spec/entities/configurations/kalibro_range_spec.rb +174 -0
  124. data/spec/entities/configurations/metric_configuration_spec.rb +230 -0
  125. data/spec/entities/configurations/range_snapshot_spec.rb +50 -0
  126. data/spec/entities/configurations/reading_group_spec.rb +60 -0
  127. data/spec/entities/configurations/reading_spec.rb +87 -0
  128. data/spec/entities/miscellaneous/base_spec.rb +49 -0
  129. data/spec/entities/miscellaneous/compound_metric_spec.rb +36 -0
  130. data/spec/entities/miscellaneous/date_metric_result_spec.rb +4 -0
  131. data/spec/entities/miscellaneous/date_module_result_spec.rb +0 -0
  132. data/spec/entities/miscellaneous/granularity_spec.rb +96 -0
  133. data/spec/entities/miscellaneous/metric_spec.rb +15 -0
  134. data/spec/entities/miscellaneous/native_metric_spec.rb +37 -0
  135. data/spec/entities/processor/base_spec.rb +26 -0
  136. data/spec/entities/processor/metric_collector_details_spec.rb +146 -0
  137. data/spec/entities/processor/metric_result_spec.rb +209 -0
  138. data/spec/entities/processor/module_result_spec.rb +178 -0
  139. data/spec/entities/processor/process_time_spec.rb +33 -0
  140. data/spec/entities/processor/processing_spec.rb +333 -0
  141. data/spec/entities/processor/project_spec.rb +68 -0
  142. data/spec/entities/processor/repository_spec.rb +140 -0
  143. data/spec/factories/date_metric_results.rb +30 -0
  144. data/spec/factories/date_module_results.rb +24 -0
  145. data/spec/factories/granularities.rb +23 -0
  146. data/spec/factories/kalibro_configurations.rb +34 -0
  147. data/spec/factories/kalibro_module.rb +28 -0
  148. data/spec/factories/kalibro_ranges.rb +40 -0
  149. data/spec/factories/metric_collector_details.rb +30 -0
  150. data/spec/factories/metric_configurations.rb +31 -0
  151. data/spec/factories/metric_results.rb +24 -0
  152. data/spec/factories/metrics.rb +48 -0
  153. data/spec/factories/models.rb +23 -0
  154. data/spec/factories/module_results.rb +43 -0
  155. data/spec/factories/process_times.rb +27 -0
  156. data/spec/factories/processings.rb +24 -0
  157. data/spec/factories/projects.rb +35 -0
  158. data/spec/factories/ranges_snapshot.rb +26 -0
  159. data/spec/factories/reading_groups.rb +28 -0
  160. data/spec/factories/readings.rb +30 -0
  161. data/spec/factories/repositories.rb +39 -0
  162. data/spec/helpers/aggregation_options_spec.rb +31 -0
  163. data/spec/helpers/hash_converters_spec.rb +111 -0
  164. data/spec/helpers/xml_converters_spec.rb +64 -0
  165. data/spec/kalibro_entities_spec.rb +112 -0
  166. data/spec/savon/fixtures/config.yml +2 -0
  167. data/spec/savon/fixtures/invalid_config.yml +2 -0
  168. data/spec/savon/fixtures/project/does_not_exists.xml +1 -0
  169. data/spec/savon/savon_test_helper.rb +14 -0
  170. data/spec/spec_helper.rb +111 -0
  171. metadata +479 -0
@@ -0,0 +1,95 @@
1
+ Given(/^I wait up to (\d+) seconds$/) do |seconds|
2
+ sleep(seconds.to_i)
3
+ end
4
+
5
+ Given(/^I wait up for a ready processing$/) do
6
+ unless KalibroClient::Entities::Processor::Processing.has_ready_processing(@repository.id)
7
+ while(true)
8
+ if KalibroClient::Entities::Processor::Processing.has_ready_processing(@repository.id)
9
+ break
10
+ else
11
+ sleep(10)
12
+ end
13
+ end
14
+ end
15
+ end
16
+
17
+ When(/^I call the has_processing for the given repository$/) do
18
+ @response = KalibroClient::Entities::Processor::Processing.has_processing(@repository.id)
19
+ end
20
+
21
+ When(/^I call the has_ready_processing for the given repository$/) do
22
+ @response = KalibroClient::Entities::Processor::Processing.has_ready_processing(@repository.id)
23
+ end
24
+
25
+ When(/^I call the has_processing_after for the given repository with yerterday's date$/) do
26
+ @response = KalibroClient::Entities::Processor::Processing.has_processing_after(@repository.id, DateTime.now - 1)
27
+ end
28
+
29
+ When(/^I call the has_processing_before for the given repository with tomorrows's date$/) do
30
+ @response = KalibroClient::Entities::Processor::Processing.has_processing_before(@repository.id, DateTime.now + 1)
31
+ end
32
+
33
+ When(/^I call the last_processing_state_of method for the given repository$/) do
34
+ @response = KalibroClient::Entities::Processor::Processing.last_processing_state_of(@repository.id)
35
+ end
36
+
37
+ When(/^I call the last_ready_processing_of method for the given repository$/) do
38
+ @response = KalibroClient::Entities::Processor::Processing.last_ready_processing_of(@repository.id)
39
+ end
40
+
41
+ When(/^I call the first_processing_of method for the given repository$/) do
42
+ @response = KalibroClient::Entities::Processor::Processing.first_processing_of(@repository.id)
43
+ end
44
+
45
+ When(/^I call the last_processing_of method for the given repository$/) do
46
+ @response = KalibroClient::Entities::Processor::Processing.last_processing_of(@repository.id)
47
+ end
48
+
49
+ When(/^I call the first_processing_after method for the given repository and yesterday's date$/) do
50
+ @response = KalibroClient::Entities::Processor::Processing.first_processing_after(@repository.id, DateTime.now - 1)
51
+ end
52
+
53
+ When(/^I call the last_processing_before method for the given repository and tomorrow's date$/) do
54
+ @response = KalibroClient::Entities::Processor::Processing.last_processing_before(@repository.id, DateTime.now + 1)
55
+ end
56
+
57
+ When(/^I call the processing_of method for the given repository$/) do
58
+ @response = KalibroClient::Entities::Processor::Processing.processing_of(@repository.id)
59
+ end
60
+
61
+ When(/^I call the processing_with_date_of method for the given repository and tomorrow's date$/) do
62
+ @response = KalibroClient::Entities::Processor::Processing.processing_with_date_of(@repository.id, DateTime.now + 1)
63
+ end
64
+
65
+ When(/^I call the processing_with_date_of method for the given repository and yesterday's date$/) do
66
+ @response = KalibroClient::Entities::Processor::Processing.processing_with_date_of(@repository.id, DateTime.now - 1)
67
+ end
68
+
69
+ Then(/^I should get a Processing with state "(.*?)"$/) do |state|
70
+ expect(@response.state).to eq(state)
71
+ end
72
+
73
+ Then(/^I should get nil$/) do
74
+ expect(@response).to be_nil
75
+ end
76
+
77
+ Then(/^I should get "(.*?)"$/) do |state|
78
+ expect(@response).to eq(state)
79
+ end
80
+
81
+ Then(/^I should get false$/) do
82
+ expect(@response).to be_falsey
83
+ end
84
+
85
+ Then(/^I should get true$/) do
86
+ expect(@response).to be_truthy
87
+ end
88
+
89
+ Then(/^I should get a Processing$/) do
90
+ expect(@response).to be_a(KalibroClient::Entities::Processor::Processing)
91
+ end
92
+
93
+ Then(/^this processing should have process times$/) do
94
+ expect(@response.process_times.first).to be_a(KalibroClient::Entities::Processor::ProcessTime)
95
+ end
@@ -0,0 +1,48 @@
1
+ Given(/^I have a project$/) do
2
+ @project = FactoryGirl.build(:project)
3
+ end
4
+
5
+ Given(/^the project name is "(.*?)"$/) do |name|
6
+ @project.name = name
7
+ end
8
+
9
+ Given(/^I have a project with name "(.*?)"$/) do |name|
10
+ @project = FactoryGirl.create(:project, {name: name})
11
+ end
12
+
13
+ When(/^I save the project$/) do
14
+ @project.save
15
+ end
16
+
17
+ When(/^I create the project with name "(.*?)"$/) do |name|
18
+ @project = FactoryGirl.create(:project, {name: name, id: nil})
19
+ end
20
+
21
+ When(/^I search a project with the same id of the given project$/) do
22
+ @found_project = KalibroClient::Entities::Processor::Project.find(@project.id)
23
+ end
24
+
25
+ When(/^I destroy the project with the same id of the given project$/) do
26
+ @found_project = KalibroClient::Entities::Processor::Project.find(@project.id)
27
+ @found_project.destroy
28
+ end
29
+
30
+ When(/^I ask for all the projects$/) do
31
+ @all_projects = KalibroClient::Entities::Processor::Project.all
32
+ end
33
+
34
+ Then(/^the project should exist$/) do
35
+ expect(KalibroClient::Entities::Processor::Project.exists?(@project.id)).to be_truthy
36
+ end
37
+
38
+ Then(/^it should return the same project as the given one$/) do
39
+ expect(@found_project).to eq(@project)
40
+ end
41
+
42
+ Then(/^the project should no longer exist$/) do
43
+ expect(KalibroClient::Entities::Processor::Project.exists?(@found_project.id)).to be_falsey
44
+ end
45
+
46
+ Then(/^I should get a list with the given project$/) do
47
+ expect(@all_projects).to include(@project)
48
+ end
@@ -0,0 +1,72 @@
1
+ Given(/^I have a range within the given reading$/) do
2
+ @range = FactoryGirl.create(:range, {reading_id: @reading.id, metric_configuration_id: @metric_configuration.id})
3
+ end
4
+
5
+ Given(/^I have an unsaved range$/) do
6
+ @range = FactoryGirl.build(:range_with_id)
7
+ end
8
+
9
+ Given(/^I have an unsaved range within the given reading$/) do
10
+ @range = FactoryGirl.build(:range, {reading_id: @reading.id, metric_configuration_id: @metric_configuration.id})
11
+ end
12
+
13
+ When(/^I ask to save the given range$/) do
14
+ @range.save
15
+ end
16
+
17
+ When(/^I ask to save the given range with an inexistent metric configuration$/) do
18
+ @range.metric_configuration_id = rand(Time.now.to_i)
19
+ @range.save
20
+ end
21
+
22
+ When(/^I ask ranges of the given metric configuration$/) do
23
+ @response = KalibroClient::Entities::Configurations::KalibroRange.ranges_of @metric_configuration.id
24
+ end
25
+
26
+ When(/^I try to save a range with an inexistent metric configuration$/) do
27
+ @range = FactoryGirl.build(:range_with_id, {reading_id: @reading.id})
28
+ @range.metric_configuration_id = rand(Time.now.to_i)
29
+ @range.save
30
+ end
31
+
32
+ When(/^I search a range with the same id of the given range$/) do
33
+ @found_range = KalibroClient::Entities::Configurations::KalibroRange.find(@range.id.to_i)
34
+ end
35
+
36
+ Then(/^I should get an empty list$/) do
37
+ expect(@response).to eq([])
38
+ end
39
+
40
+ Then(/^I should not get an empty list$/) do
41
+ expect(@response).to_not eq([])
42
+ end
43
+
44
+ Then(/^I should get a list with the given range$/) do
45
+ expect(@response.size).to eq(1)
46
+ expect(@response.first.comments).to eq(@range.comments)
47
+ end
48
+
49
+ Then(/^I should get an error in range kalibro errors attribute$/) do
50
+ expect(@range.kalibro_errors).to_not eq([])
51
+ end
52
+
53
+ Then(/^the id of the given range should be set$/) do
54
+ expect(@range.id).to_not eq(0)
55
+ end
56
+
57
+ Then(/^it should return the same range as the given one$/) do
58
+ expect(@found_range).to eq(@range)
59
+ end
60
+
61
+ Then(/^the range should exist$/) do
62
+ expect(KalibroClient::Entities::Configurations::KalibroRange.exists?(@range.id)).to be_truthy
63
+ end
64
+
65
+ When(/^I destroy the range$/) do
66
+ @range.destroy
67
+ end
68
+
69
+ Then(/^the range should no longer exist$/) do
70
+ expect(KalibroClient::Entities::Configurations::KalibroRange.exists?(@range.id)).to be_falsey
71
+ end
72
+
@@ -0,0 +1,36 @@
1
+ Given(/^I have a reading group with name "(.*?)"$/) do |name|
2
+ @reading_group = FactoryGirl.create(:reading_group, {name: name})
3
+ end
4
+
5
+ When(/^I ask for all the reading groups$/) do
6
+ @all_reading_groups = KalibroClient::Entities::Configurations::ReadingGroup.all
7
+ end
8
+
9
+ When(/^I call the reading_group_of method for the given MetricConfiguration$/) do
10
+ @metric_configuration_reading_group = KalibroClient::Entities::Configurations::ReadingGroup.reading_group_of(@metric_configuration.id)
11
+ end
12
+
13
+ Then(/^I should get a list with the given reading group$/) do
14
+ expect(@all_reading_groups).to include(@reading_group)
15
+ end
16
+
17
+ Then(/^I should get the given RedingGroup$/) do
18
+ expect(@metric_configuration_reading_group).to eq(@reading_group)
19
+ end
20
+
21
+ When(/^I destroy the reading group$/) do
22
+ @reading_group.destroy
23
+ end
24
+
25
+ Then(/^the reading group should no longer exist$/) do
26
+ expect(KalibroClient::Entities::Configurations::ReadingGroup.exists?(@reading_group.id)).to be_falsey
27
+ end
28
+
29
+ When(/^I create a reading group with name "(.*?)"$/) do |name|
30
+ @reading_group = FactoryGirl.create(:reading_group, {name: name})
31
+ end
32
+
33
+ Then(/^the reading group should exist$/) do
34
+ expect(KalibroClient::Entities::Configurations::ReadingGroup.exists?(@reading_group.id)).to be_truthy
35
+ end
36
+
@@ -0,0 +1,47 @@
1
+ Given(/^the given reading group has the following readings:$/) do |table|
2
+ hash = table.hashes.first
3
+ hash[:reading_group_id] = @reading_group.id
4
+
5
+ @reading = FactoryGirl.create(:reading, hash)
6
+ end
7
+
8
+ Given(/^I have a reading within the given reading group$/) do
9
+ @reading = FactoryGirl.create(:reading, {reading_group_id: @reading_group.id})
10
+ end
11
+
12
+ When(/^I ask for all the readings$/) do
13
+ @all_readings = KalibroClient::Entities::Configurations::Reading.all
14
+ end
15
+
16
+ When(/^I ask for a reading with the same id of the given reading$/) do
17
+ @found_reading = KalibroClient::Entities::Configurations::Reading.find @reading.id
18
+ end
19
+
20
+ When(/^I ask for the readings of the given reading group$/) do
21
+ @found_readings = KalibroClient::Entities::Configurations::Reading.readings_of @reading_group.id
22
+ end
23
+
24
+ When(/^I ask to check if the given reading exists$/) do
25
+ @response = KalibroClient::Entities::Configurations::Reading.exists?(@reading.id)
26
+ end
27
+
28
+ Then(/^I should get the given reading$/) do
29
+ expect(@found_reading).to eq(@reading)
30
+ end
31
+
32
+ Then(/^I should get a list with the given reading$/) do
33
+ expect(@found_readings.first).to eq(@reading)
34
+ end
35
+
36
+ Then(/^the response should contain the given reading$/) do
37
+ expect(@all_readings.first).to eq(@reading)
38
+ end
39
+
40
+ When(/^I destroy the reading$/) do
41
+ @reading.destroy
42
+ end
43
+
44
+ Then(/^the reading should no longer exist$/) do
45
+ expect(KalibroClient::Entities::Configurations::Reading.exists?(@reading.id)).to be_falsey
46
+ end
47
+
@@ -0,0 +1,71 @@
1
+ Given(/^the given project has the following Repositories:$/) do |table|
2
+ hash = table.hashes.first
3
+ hash[:project_id] = @project.id
4
+ hash[:configuration_id] = @configuration.id
5
+
6
+ @repository = FactoryGirl.create(:repository, hash)
7
+ end
8
+
9
+ When(/^I call the cancel_process method for the given repository$/) do
10
+ @response = @repository.cancel_processing_of_repository
11
+ end
12
+
13
+ When(/^I ask for repositories from the given project$/) do
14
+ @response = KalibroClient::Entities::Processor::Repository.repositories_of(@project.id)
15
+ end
16
+
17
+ When(/^I call the process method for the given repository$/) do
18
+ @response = @repository.process
19
+ end
20
+
21
+ When(/^I list types$/) do
22
+ @repository_types = KalibroClient::Entities::Processor::Repository.repository_types
23
+ end
24
+
25
+ When(/^I ask for all the repositories$/) do
26
+ @response = KalibroClient::Entities::Processor::Repository.all
27
+ end
28
+
29
+ When(/^I ask to find the given repository$/) do
30
+ @response = KalibroClient::Entities::Processor::Repository.find(@repository.id)
31
+ end
32
+
33
+ When(/^I ask to check if the given repository exists$/) do
34
+ @response = KalibroClient::Entities::Processor::Repository.exists?(@repository.id)
35
+ end
36
+
37
+ Then(/^I should get success$/) do
38
+ expect(@response).to be_truthy
39
+ end
40
+
41
+ Then(/^I should get a list with the given repository$/) do
42
+ expect(@response).to include(@repository)
43
+ end
44
+
45
+ Then(/^I should get an array of types$/) do
46
+ expect(@repository_types).to be_a(Array)
47
+ expect(@repository_types.count >= 1).to be_truthy
48
+ expect(@repository_types).to include("GIT")
49
+ expect(@repository_types).to include("SVN")
50
+ end
51
+
52
+ Then(/^I should get the given repository$/) do
53
+ expect(@response).to eq(@repository)
54
+ end
55
+
56
+ Then(/^the response should contain the given repository$/) do
57
+ expect(@response.first.project_id).to eq(@project.id)
58
+ end
59
+
60
+ Then(/^the repositories should contain the project id$/) do
61
+ expect(@response.first.project_id).to eq(@project.id)
62
+ end
63
+
64
+ When(/^I destroy the repository$/) do
65
+ @repository.destroy
66
+ end
67
+
68
+ Then(/^the repository should no longer exist$/) do
69
+ expect(KalibroClient::Entities::Processor::Repository.exists?(@repository.id)).to be_falsey
70
+ end
71
+
@@ -0,0 +1,25 @@
1
+ # SimpleCov for test coverage report
2
+ require 'simplecov'
3
+ SimpleCov.start do
4
+ add_group "Entities", "lib/kalibro_client/entities"
5
+ add_group "Errors", "lib/kalibro_client/errors"
6
+ add_group "Helpers", "lib/kalibro_client/helpers"
7
+ add_group "Cucumber Helpers", "lib/kalibro_client/kalibro_cucumber_helpers"
8
+
9
+ add_filter "/spec/"
10
+ add_filter "/features/"
11
+
12
+ coverage_dir 'coverage/cucumber'
13
+ end
14
+
15
+ # Kalibro hooks
16
+ require 'kalibro_client/kalibro_cucumber_helpers/hooks'
17
+
18
+ # Configuring the right hooks
19
+ KalibroClient::KalibroCucumberHelpers.configure_from_yml("#{__dir__}/kalibro_cucumber_helpers.yml")
20
+
21
+ # The gem itself
22
+ require 'kalibro_client'
23
+
24
+ require 'factory_girl'
25
+ FactoryGirl.find_definitions
@@ -0,0 +1,3 @@
1
+ kalibro_cucumber_helpers:
2
+ kalibro_processor_address: "http://localhost:8082"
3
+ kalibro_configurations_address: "http://localhost:8083"
@@ -0,0 +1,49 @@
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
+ # coding: utf-8
18
+ lib = File.expand_path('../lib', __FILE__)
19
+
20
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
21
+ require 'kalibro_client/version'
22
+
23
+ Gem::Specification.new do |spec|
24
+ spec.name = "kalibro_client"
25
+ spec.version = KalibroClient::VERSION
26
+ spec.authors = ["Diego de Araújo Martinez Camarinha", "Daniel Paulino Alves", "Rafael Reggiani Manzo", "Heitor Reis Ribeiro"]
27
+ spec.email = ["diegamc90@gmail.com", "danpaulalves@gmail.com", "rr.manzo@gmail.com", "marcheing@gmail.com"]
28
+ spec.description = "KalibroClient is a Ruby gem intended to be an interface for Ruby applications who want to use the open source code analysis webservice Kalibro."
29
+ spec.summary = "KalibroClient is a communication interface with the KalibroProcessor and KalibroConfigurations services."
30
+ spec.homepage = "https://github.com/mezuro/kalibro_client"
31
+ spec.license = "LGPLv3"
32
+
33
+ spec.files = `git ls-files`.split($/)
34
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
35
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
36
+ spec.require_paths = ["lib"]
37
+
38
+ spec.add_development_dependency "bundler", "~> 1.3"
39
+ spec.add_development_dependency "rake"
40
+ spec.add_development_dependency "rspec", "~> 3.1.0"
41
+ spec.add_development_dependency "cucumber", "~> 1.3.14"
42
+ spec.add_development_dependency "mocha", "~> 1.1.0"
43
+ spec.add_development_dependency "simplecov"
44
+ spec.add_development_dependency "factory_girl", "~> 4.4.0"
45
+ spec.add_development_dependency 'coveralls'
46
+
47
+ spec.add_dependency "activesupport", ">= 2.2.1" #version in which underscore was introduced
48
+ spec.add_dependency "faraday_middleware", "~> 0.9.0"
49
+ end