kalibro_entities 0.0.1.rc1
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 +7 -0
- data/.gitignore +19 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +21 -0
- data/AUTHORS +4 -0
- data/COPYING +674 -0
- data/COPYING.LESSER +165 -0
- data/Gemfile +4 -0
- data/README.md +77 -0
- data/Rakefile +6 -0
- data/cucumber.yml +1 -0
- data/features/base_tool/all_names.feature +8 -0
- data/features/base_tool/find_by_name.feature +12 -0
- data/features/configuration/all.feature +10 -0
- data/features/metric_configuration/find.feature +18 -0
- data/features/metric_configuration/metric_configurations_of.feature +18 -0
- data/features/metric_result/descendant_results.feature +19 -0
- data/features/metric_result/history_of.feature +20 -0
- data/features/metric_result/metric_results_of.feature +19 -0
- data/features/module_result/children.feature +18 -0
- data/features/module_result/find.feature +15 -0
- data/features/module_result/history_of.feature +11 -0
- data/features/processing/first_processing_after.feature +18 -0
- data/features/processing/first_processing_of.feature +18 -0
- data/features/processing/has_processing.feature +18 -0
- data/features/processing/has_processing_after.feature +18 -0
- data/features/processing/has_processing_before.feature +18 -0
- data/features/processing/has_ready_processing.feature +18 -0
- data/features/processing/last_processing_before.feature +18 -0
- data/features/processing/last_processing_of.feature +18 -0
- data/features/processing/last_processing_state_of.feature +18 -0
- data/features/processing/last_ready_processing_of.feature +18 -0
- data/features/processing/processing_of.feature +32 -0
- data/features/processing/processing_with_date_of.feature +32 -0
- data/features/project/all.feature +10 -0
- data/features/project/creation.feature +9 -0
- data/features/project/destroy.feature +10 -0
- data/features/project/exists.feature +9 -0
- data/features/project/find.feature +10 -0
- data/features/range/ranges_of.feature +22 -0
- data/features/range/save.feature +32 -0
- data/features/reading/find.feature +11 -0
- data/features/reading/readings_of.feature +11 -0
- data/features/reading_group/all.feature +10 -0
- data/features/repository/all.feature +14 -0
- data/features/repository/cancel_processing.feature +14 -0
- data/features/repository/find.feature +14 -0
- data/features/repository/of.feature +15 -0
- data/features/repository/process.feature +16 -0
- data/features/repository/types.feature +9 -0
- data/features/step_definitions/base_tool_steps.rb +28 -0
- data/features/step_definitions/configuration_steps.rb +11 -0
- data/features/step_definitions/metric_configuration_steps.rb +52 -0
- data/features/step_definitions/metric_result_steps.rb +29 -0
- data/features/step_definitions/metric_steps.rb +3 -0
- data/features/step_definitions/module_result_steps.rb +30 -0
- data/features/step_definitions/processing_steps.rb +91 -0
- data/features/step_definitions/project_steps.rb +48 -0
- data/features/step_definitions/range_steps.rb +41 -0
- data/features/step_definitions/reading_group_steps.rb +19 -0
- data/features/step_definitions/reading_steps.rb +20 -0
- data/features/step_definitions/repository_steps.rb +57 -0
- data/features/support/env.rb +25 -0
- data/features/support/kalibro_cucumber_helpers.yml.sample +10 -0
- data/kalibro_entities.gemspec +48 -0
- data/lib/kalibro_entities.rb +61 -0
- data/lib/kalibro_entities/entities.rb +37 -0
- data/lib/kalibro_entities/entities/base_tool.rb +54 -0
- data/lib/kalibro_entities/entities/configuration.rb +33 -0
- data/lib/kalibro_entities/entities/date_metric_result.rb +39 -0
- data/lib/kalibro_entities/entities/date_module_result.rb +39 -0
- data/lib/kalibro_entities/entities/metric.rb +21 -0
- data/lib/kalibro_entities/entities/metric_configuration.rb +70 -0
- data/lib/kalibro_entities/entities/metric_configuration_snapshot.rb +57 -0
- data/lib/kalibro_entities/entities/metric_result.rb +63 -0
- data/lib/kalibro_entities/entities/model.rb +162 -0
- data/lib/kalibro_entities/entities/module.rb +27 -0
- data/lib/kalibro_entities/entities/module_result.rb +69 -0
- data/lib/kalibro_entities/entities/process_time.rb +31 -0
- data/lib/kalibro_entities/entities/processing.rb +113 -0
- data/lib/kalibro_entities/entities/project.rb +34 -0
- data/lib/kalibro_entities/entities/range.rb +75 -0
- data/lib/kalibro_entities/entities/range_snapshot.rb +37 -0
- data/lib/kalibro_entities/entities/reading.rb +51 -0
- data/lib/kalibro_entities/entities/reading_group.rb +43 -0
- data/lib/kalibro_entities/entities/repository.rb +78 -0
- data/lib/kalibro_entities/entities/repository_observer.rb +50 -0
- data/lib/kalibro_entities/entities/stack_trace_element.rb +31 -0
- data/lib/kalibro_entities/entities/throwable.rb +42 -0
- data/lib/kalibro_entities/errors.rb +18 -0
- data/lib/kalibro_entities/errors/record_not_found.rb +22 -0
- data/lib/kalibro_entities/errors/standard.rb +24 -0
- data/lib/kalibro_entities/helpers/aggregation_options.rb +25 -0
- data/lib/kalibro_entities/helpers/hash_converters.rb +48 -0
- data/lib/kalibro_entities/helpers/request_methods.rb +47 -0
- data/lib/kalibro_entities/helpers/xml_converters.rb +20 -0
- data/lib/kalibro_entities/kalibro_cucumber_helpers.rb +40 -0
- data/lib/kalibro_entities/kalibro_cucumber_helpers/configuration.rb +39 -0
- data/lib/kalibro_entities/kalibro_cucumber_helpers/hooks.rb +50 -0
- data/lib/kalibro_entities/kalibro_cucumber_helpers/scripts/delete_all_kalibro_entries.sh +23 -0
- data/lib/kalibro_entities/kalibro_cucumber_helpers/scripts/prepare_kalibro_query_file.sh +38 -0
- data/lib/kalibro_entities/kalibro_cucumber_helpers/scripts/put_kalibro_on_test_mode.sh +35 -0
- data/lib/kalibro_entities/kalibro_cucumber_helpers/scripts/return_kalibro_from_test_mode.sh +26 -0
- data/lib/kalibro_entities/version.rb +19 -0
- data/lib/rake/test_task.rb +57 -0
- data/spec/entities/base_tool_spec.rb +168 -0
- data/spec/entities/configuration_spec.rb +61 -0
- data/spec/entities/date_metric_result_spec.rb +62 -0
- data/spec/entities/date_module_result_spec.rb +61 -0
- data/spec/entities/metric_configuration_snapshot_spec.rb +107 -0
- data/spec/entities/metric_configuration_spec.rb +149 -0
- data/spec/entities/metric_result_spec.rb +193 -0
- data/spec/entities/metric_spec.rb +47 -0
- data/spec/entities/model_spec.rb +275 -0
- data/spec/entities/module_result_spec.rb +135 -0
- data/spec/entities/process_time_spec.rb +33 -0
- data/spec/entities/processing_spec.rb +334 -0
- data/spec/entities/project_spec.rb +68 -0
- data/spec/entities/range_snapshot_spec.rb +50 -0
- data/spec/entities/range_spec.rb +181 -0
- data/spec/entities/reading_group_spec.rb +90 -0
- data/spec/entities/reading_spec.rb +106 -0
- data/spec/entities/repository_observer_spec.rb +123 -0
- data/spec/entities/repository_spec.rb +167 -0
- data/spec/entities/stack_trace_element_spec.rb +26 -0
- data/spec/entities/throwable_spec.rb +51 -0
- data/spec/factories/base_tools.rb +31 -0
- data/spec/factories/configurations.rb +29 -0
- data/spec/factories/date_metric_results.rb +28 -0
- data/spec/factories/date_module_results.rb +22 -0
- data/spec/factories/metric_configurations.rb +28 -0
- data/spec/factories/metric_configurations_snapshot.rb +26 -0
- data/spec/factories/metric_results.rb +24 -0
- data/spec/factories/metrics.rb +35 -0
- data/spec/factories/models.rb +20 -0
- data/spec/factories/module_results.rb +33 -0
- data/spec/factories/modules.rb +22 -0
- data/spec/factories/process_times.rb +27 -0
- data/spec/factories/processings.rb +25 -0
- data/spec/factories/projects.rb +29 -0
- data/spec/factories/ranges.rb +30 -0
- data/spec/factories/ranges_snapshot.rb +26 -0
- data/spec/factories/reading_groups.rb +23 -0
- data/spec/factories/readings.rb +25 -0
- data/spec/factories/repositories.rb +34 -0
- data/spec/factories/repository_observers.rb +24 -0
- data/spec/factories/stack_trace_elements.rb +24 -0
- data/spec/factories/throwables.rb +23 -0
- data/spec/helpers/aggregation_options_spec.rb +31 -0
- data/spec/helpers/hash_converters_spec.rb +111 -0
- data/spec/helpers/xml_converters_spec.rb +64 -0
- data/spec/kalibro_entities_spec.rb +108 -0
- data/spec/savon/fixtures/config.yml +1 -0
- data/spec/savon/fixtures/invalid_config.yml +2 -0
- data/spec/savon/fixtures/project/does_not_exists.xml +1 -0
- data/spec/savon/savon_test_helper.rb +14 -0
- data/spec/spec_helper.rb +60 -0
- metadata +461 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
Feature: Process
|
2
|
+
In order to be have repositories
|
3
|
+
As a developer
|
4
|
+
I want to start the repository processing
|
5
|
+
|
6
|
+
@kalibro_restart
|
7
|
+
Scenario: With one repository
|
8
|
+
Given I have a project with name "Kalibro"
|
9
|
+
And I have a configuration with name "Java"
|
10
|
+
And I have a reading group with name "Group"
|
11
|
+
And I have a metric configuration within the given configuration
|
12
|
+
And the given project has the following Repositories:
|
13
|
+
| name | type | address |
|
14
|
+
| Kalibro | GIT | https://github.com/mezuro/kalibro.git |
|
15
|
+
When I call the process method for the given repository
|
16
|
+
Then I should get success
|
@@ -0,0 +1,28 @@
|
|
1
|
+
When(/^I get all base tool names$/) do
|
2
|
+
@base_tool_names = KalibroEntities::Entities::BaseTool.all_names
|
3
|
+
end
|
4
|
+
|
5
|
+
When(/^I search base tool Analizo by name$/) do
|
6
|
+
@result = KalibroEntities::Entities::BaseTool.find_by_name("Analizo")
|
7
|
+
end
|
8
|
+
|
9
|
+
When(/^I search base tool Avalio by name$/) do
|
10
|
+
@is_error = false
|
11
|
+
begin
|
12
|
+
KalibroEntities::Entities::BaseTool.find_by_name("Avalio")
|
13
|
+
rescue KalibroEntities::Errors::RecordNotFound
|
14
|
+
@is_error = true
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
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
|
20
|
+
end
|
21
|
+
|
22
|
+
Then(/^I should get Analizo base tool$/) do
|
23
|
+
@result.name.should eq "Analizo"
|
24
|
+
end
|
25
|
+
|
26
|
+
Then(/^I should get an error$/) do
|
27
|
+
@is_error.should be_true
|
28
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Given(/^I have a configuration with name "(.*?)"$/) do |name|
|
2
|
+
@configuration = FactoryGirl.create(:configuration, {name: name, id: nil})
|
3
|
+
end
|
4
|
+
|
5
|
+
When(/^I get all the configurations$/) do
|
6
|
+
@all_configurations = KalibroEntities::Entities::Configuration.all
|
7
|
+
end
|
8
|
+
|
9
|
+
Then(/^I should get a list with the given configuration$/) do
|
10
|
+
@all_configurations.include?(@configuration)
|
11
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
Given(/^I have a metric configuration within the given configuration$/) do
|
2
|
+
@metric_configuration = FactoryGirl.create(:metric_configuration,
|
3
|
+
{id: nil,
|
4
|
+
reading_group_id: @reading_group.id,
|
5
|
+
configuration_id: @configuration.id})
|
6
|
+
end
|
7
|
+
|
8
|
+
Given(/^I have a metric configuration within the given configuration with the given metric$/) do
|
9
|
+
@metric_configuration = FactoryGirl.create(:metric_configuration,
|
10
|
+
{id: nil,
|
11
|
+
metric: @metric,
|
12
|
+
reading_group_id: @reading_group.id,
|
13
|
+
configuration_id: @configuration.id})
|
14
|
+
end
|
15
|
+
|
16
|
+
Given(/^I have a loc configuration within the given configuration$/) do
|
17
|
+
@metric_configuration = FactoryGirl.create(:metric_configuration,
|
18
|
+
{id: nil,
|
19
|
+
metric: FactoryGirl.create(:loc),
|
20
|
+
reading_group_id: @reading_group.id,
|
21
|
+
configuration_id: @configuration.id})
|
22
|
+
end
|
23
|
+
|
24
|
+
When(/^I search a metric configuration with the same id of the given metric configuration$/) do
|
25
|
+
@found_metric_configuration = KalibroEntities::Entities::MetricConfiguration.find(@metric_configuration.id)
|
26
|
+
end
|
27
|
+
|
28
|
+
When(/^I search an inexistent metric configuration$/) do
|
29
|
+
@is_error = false
|
30
|
+
inexistent_id = rand(Time.now.to_i)
|
31
|
+
begin
|
32
|
+
KalibroEntities::Entities::MetricConfiguration.find(inexistent_id)
|
33
|
+
rescue KalibroEntities::Errors::RecordNotFound
|
34
|
+
@is_error = true
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
When(/^I request all metric configurations of the given configuration$/) do
|
39
|
+
@metric_configurations = KalibroEntities::Entities::MetricConfiguration.metric_configurations_of(@configuration.id)
|
40
|
+
end
|
41
|
+
|
42
|
+
Then(/^it should return the same metric configuration as the given one$/) do
|
43
|
+
@found_metric_configuration == @metric_configuration
|
44
|
+
end
|
45
|
+
|
46
|
+
Then(/^I should get a list of its metric configurations$/) do
|
47
|
+
@metric_configurations == [@metric_configuration]
|
48
|
+
end
|
49
|
+
|
50
|
+
Then(/^I should get an empty list of metric configurations$/) do
|
51
|
+
@metric_configurations == []
|
52
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
When(/^I call the metric results of method with the results root id of the given processing$/) do
|
2
|
+
@response = KalibroEntities::Entities::MetricResult.metric_results_of(@response.results_root_id)
|
3
|
+
end
|
4
|
+
|
5
|
+
Given(/^I search a metric result with descendant results for the given metric result$/) do
|
6
|
+
first_module_result = KalibroEntities::Entities::ModuleResult.find(@response.results_root_id)
|
7
|
+
|
8
|
+
metric_results = KalibroEntities::Entities::MetricResult.metric_results_of(first_module_result.id)
|
9
|
+
@response = metric_results.first.descendant_results
|
10
|
+
end
|
11
|
+
|
12
|
+
When(/^I call the history of method with the metric name and the results root id of the given processing$/) do
|
13
|
+
@response = KalibroEntities::Entities::MetricResult.history_of(@metric.name, @response.results_root_id)
|
14
|
+
end
|
15
|
+
|
16
|
+
Then (/^I should get a Float list$/) do
|
17
|
+
@response.should be_a(Array)
|
18
|
+
@response.first.should be_a(Float)
|
19
|
+
end
|
20
|
+
|
21
|
+
Then(/^I should get a list of metric results$/) do
|
22
|
+
@response.should be_a(Array)
|
23
|
+
@response.first.should be_a(KalibroEntities::Entities::MetricResult)
|
24
|
+
end
|
25
|
+
|
26
|
+
Then(/^I should get a list of date metric results$/) do
|
27
|
+
@response.should be_a(Array)
|
28
|
+
@response.first.should be_a(KalibroEntities::Entities::DateMetricResult)
|
29
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Given(/^I have a module result$/) do
|
2
|
+
Pending
|
3
|
+
@module_result = FactoryGirl.create(:module_result)
|
4
|
+
end
|
5
|
+
|
6
|
+
When(/^I ask a module result with the same id of the given module result$/) do
|
7
|
+
@found_module_result = KalibroEntities::Entities::ModuleResult.find(@module_result.id)
|
8
|
+
end
|
9
|
+
|
10
|
+
When(/^I ask for an inexistent module result$/) do
|
11
|
+
@is_error = false
|
12
|
+
begin
|
13
|
+
KalibroEntities::Entities::ModuleResult.find(-1)
|
14
|
+
rescue KalibroEntities::Errors::RecordNotFound
|
15
|
+
@is_error = true
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
Then(/^I should get the given module result$/) do
|
20
|
+
@found_module_result == @module_result
|
21
|
+
end
|
22
|
+
|
23
|
+
When(/^I ask for the children of the processing root module result$/) do
|
24
|
+
@children = KalibroEntities::Entities::ModuleResult.
|
25
|
+
find(KalibroEntities::Entities::Processing.processing_of(@repository.id).results_root_id)
|
26
|
+
end
|
27
|
+
|
28
|
+
Then(/^I should get a list with the children module results$/) do
|
29
|
+
@children.should be_a(KalibroEntities::Entities::ModuleResult)
|
30
|
+
end
|
@@ -0,0 +1,91 @@
|
|
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 KalibroEntities::Entities::Processing.has_ready_processing(@repository.id)
|
7
|
+
while(true)
|
8
|
+
if KalibroEntities::Entities::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 = KalibroEntities::Entities::Processing.has_processing(@repository.id)
|
19
|
+
end
|
20
|
+
|
21
|
+
When(/^I call the has_ready_processing for the given repository$/) do
|
22
|
+
@response = KalibroEntities::Entities::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 = KalibroEntities::Entities::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 = KalibroEntities::Entities::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 = KalibroEntities::Entities::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 = KalibroEntities::Entities::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 = KalibroEntities::Entities::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 = KalibroEntities::Entities::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 = KalibroEntities::Entities::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 = KalibroEntities::Entities::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 = KalibroEntities::Entities::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 = KalibroEntities::Entities::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 = KalibroEntities::Entities::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
|
+
@response.state.should eq(state)
|
71
|
+
end
|
72
|
+
|
73
|
+
Then(/^I should get nil$/) do
|
74
|
+
@response.should be_nil
|
75
|
+
end
|
76
|
+
|
77
|
+
Then(/^I should get "(.*?)"$/) do |state|
|
78
|
+
@response.should eq(state)
|
79
|
+
end
|
80
|
+
|
81
|
+
Then(/^I should get false$/) do
|
82
|
+
@response.should be_false
|
83
|
+
end
|
84
|
+
|
85
|
+
Then(/^I should get true$/) do
|
86
|
+
@response.should be_true
|
87
|
+
end
|
88
|
+
|
89
|
+
Then(/^I should get a Processing$/) do
|
90
|
+
@response.should be_a(KalibroEntities::Entities::Processing)
|
91
|
+
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, id: nil})
|
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 = KalibroEntities::Entities::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 = KalibroEntities::Entities::Project.find(@project.id)
|
27
|
+
@found_project.destroy
|
28
|
+
end
|
29
|
+
|
30
|
+
When(/^I ask for all the projects$/) do
|
31
|
+
@all_projects = KalibroEntities::Entities::Project.all
|
32
|
+
end
|
33
|
+
|
34
|
+
Then(/^the project should exist$/) do
|
35
|
+
KalibroEntities::Entities::Project.exists?(@project.id)
|
36
|
+
end
|
37
|
+
|
38
|
+
Then(/^it should return the same project as the given one$/) do
|
39
|
+
@found_project == @project
|
40
|
+
end
|
41
|
+
|
42
|
+
Then(/^the project should not exist$/) do
|
43
|
+
!KalibroEntities::Entities::Project.exists?(@found_project.id)
|
44
|
+
end
|
45
|
+
|
46
|
+
Then(/^I should get a list with the given project$/) do
|
47
|
+
@all_projects.include?(@project)
|
48
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
Given(/^I have a range within the given reading$/) do
|
2
|
+
@range = FactoryGirl.build(:range, {id: nil, reading_id: @reading.id})
|
3
|
+
@range.save @metric_configuration.id
|
4
|
+
end
|
5
|
+
|
6
|
+
Given(/^I have an unsaved range$/) do
|
7
|
+
@range = FactoryGirl.build(:range, {id: nil})
|
8
|
+
end
|
9
|
+
|
10
|
+
Given(/^I have an unsaved range within the given reading$/) do
|
11
|
+
@range = FactoryGirl.build(:range, {id: nil, reading_id: @reading.id})
|
12
|
+
end
|
13
|
+
|
14
|
+
When(/^I ask to save the given range$/) do
|
15
|
+
@range.save @metric_configuration.id
|
16
|
+
end
|
17
|
+
|
18
|
+
When(/^I ask to save the given range with an inexistent metric configuration$/) do
|
19
|
+
@range.save rand(Time.now.to_i)
|
20
|
+
end
|
21
|
+
|
22
|
+
When(/^I ask ranges of the given metric configuration$/) do
|
23
|
+
@response = KalibroEntities::Entities::Range.ranges_of @metric_configuration.id
|
24
|
+
end
|
25
|
+
|
26
|
+
Then(/^I should get an empty list$/) do
|
27
|
+
@response.should eq([])
|
28
|
+
end
|
29
|
+
|
30
|
+
Then(/^I should get a list with the given range$/) do
|
31
|
+
@response.size.should eq(1)
|
32
|
+
@response.first.comments.should eq(@range.comments)
|
33
|
+
end
|
34
|
+
|
35
|
+
Then(/^I should get an error in range kalibro errors attribute$/) do
|
36
|
+
@range.kalibro_errors.should_not eq([])
|
37
|
+
end
|
38
|
+
|
39
|
+
Then(/^the id of the given range should be set$/) do
|
40
|
+
@range.id.should_not eq(0)
|
41
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Given(/^I have a reading group with name "(.*?)"$/) do |name|
|
2
|
+
@reading_group = FactoryGirl.create(:reading_group, {id: nil, name: name})
|
3
|
+
end
|
4
|
+
|
5
|
+
When(/^I ask for all the reading groups$/) do
|
6
|
+
@all_reading_groups = KalibroEntities::Entities::ReadingGroup.all
|
7
|
+
end
|
8
|
+
|
9
|
+
When(/^I call the reading_group_of method for the given MetricConfiguration$/) do
|
10
|
+
@metric_configuration_reading_group = KalibroEntities::Entities::ReadingGroup.reading_group_of(@metric_configuration.id)
|
11
|
+
end
|
12
|
+
|
13
|
+
Then(/^I should get a list with the given reading group$/) do
|
14
|
+
@all_reading_groups.include?(@reading_group)
|
15
|
+
end
|
16
|
+
|
17
|
+
Then(/^I should get the given RedingGroup$/) do
|
18
|
+
@metric_configuration_reading_group.should eq(@reading_group)
|
19
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Given(/^I have a reading within the given reading group$/) do
|
2
|
+
@reading = FactoryGirl.create(:reading, {id: nil, group_id: @reading_group.id})
|
3
|
+
end
|
4
|
+
|
5
|
+
When(/^I ask for a reading with the same id of the given reading$/) do
|
6
|
+
@found_reading = KalibroEntities::Entities::Reading.find @reading.id
|
7
|
+
end
|
8
|
+
|
9
|
+
When(/^I ask for the readings of the given reading group$/) do
|
10
|
+
@found_readings = KalibroEntities::Entities::Reading.readings_of @reading_group.id
|
11
|
+
end
|
12
|
+
|
13
|
+
Then(/^I should get the given reading$/) do
|
14
|
+
@found_reading == @reading
|
15
|
+
end
|
16
|
+
|
17
|
+
Then(/^I should get a list with the given reading$/) do
|
18
|
+
@found_readings.first == @reading
|
19
|
+
end
|
20
|
+
|
@@ -0,0 +1,57 @@
|
|
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
|
+
hash[:id] = nil
|
6
|
+
|
7
|
+
@repository = FactoryGirl.create(:repository, hash)
|
8
|
+
end
|
9
|
+
|
10
|
+
When(/^I call the cancel_process method for the given repository$/) do
|
11
|
+
@response = @repository.cancel_processing_of_repository
|
12
|
+
end
|
13
|
+
|
14
|
+
When(/^I ask for repositories from the given project$/) do
|
15
|
+
@response = KalibroEntities::Entities::Repository.repositories_of(@project.id)
|
16
|
+
end
|
17
|
+
|
18
|
+
When(/^I call the process method for the given repository$/) do
|
19
|
+
@response = @repository.process
|
20
|
+
end
|
21
|
+
|
22
|
+
When(/^I list types$/) do
|
23
|
+
@repository_types = KalibroEntities::Entities::Repository.repository_types
|
24
|
+
end
|
25
|
+
|
26
|
+
When(/^I ask for all the repositories$/) do
|
27
|
+
@response = KalibroEntities::Entities::Repository.all
|
28
|
+
end
|
29
|
+
|
30
|
+
When(/^I ask to find the given repository$/) do
|
31
|
+
@response = KalibroEntities::Entities::Repository.find(@repository.id)
|
32
|
+
end
|
33
|
+
|
34
|
+
Then(/^I should get success$/) do
|
35
|
+
@response == true
|
36
|
+
end
|
37
|
+
|
38
|
+
Then(/^I should get a list with the given repository$/) do
|
39
|
+
@response.should include(@repository)
|
40
|
+
end
|
41
|
+
|
42
|
+
Then(/^I should get an array of types$/) do
|
43
|
+
@repository_types.is_a?(Array)
|
44
|
+
@repository_types.count >= 1
|
45
|
+
end
|
46
|
+
|
47
|
+
Then(/^I should get the given repository$/) do
|
48
|
+
@response.should eq(@repository)
|
49
|
+
end
|
50
|
+
|
51
|
+
Then(/^the response should contain the given repository$/) do
|
52
|
+
@response.first.project_id.should eq(@project.id)
|
53
|
+
end
|
54
|
+
|
55
|
+
Then(/^the repositories should contain the project id$/) do
|
56
|
+
@response.first.project_id.should eq(@project.id)
|
57
|
+
end
|