kalibro_client 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +27 -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/kalibro_configuration/all.feature +10 -0
- data/features/kalibro_configuration/creation.feature +9 -0
- data/features/kalibro_configuration/destroy.feature +10 -0
- data/features/kalibro_configuration/metric_configurations.feature +12 -0
- data/features/metric_collector_details/all_names.feature +8 -0
- data/features/metric_collector_details/find_by_name.feature +12 -0
- data/features/metric_configuration/creation.feature +11 -0
- data/features/metric_configuration/destroy.feature +12 -0
- data/features/metric_configuration/find.feature +18 -0
- data/features/metric_configuration/metric_configurations_of.feature +18 -0
- data/features/metric_result/descendant_values.feature +19 -0
- data/features/metric_result/history_of.feature +20 -0
- data/features/metric_result/metric_results_of.feature +20 -0
- data/features/module_result/children.feature +19 -0
- data/features/module_result/find.feature +22 -0
- data/features/module_result/history_of.feature +19 -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 +19 -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/destroy.feature +14 -0
- data/features/range/exists.feature +13 -0
- data/features/range/find.feature +14 -0
- data/features/range/ranges_of.feature +22 -0
- data/features/range/save.feature +14 -0
- data/features/reading/destroy.feature +13 -0
- data/features/reading/exists.feature +13 -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/reading_group/creation.feature +9 -0
- data/features/reading_group/destroy.feature +11 -0
- data/features/repository/all.feature +14 -0
- data/features/repository/cancel_processing.feature +14 -0
- data/features/repository/destroy.feature +14 -0
- data/features/repository/exists.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 +8 -0
- data/features/step_definitions/configuration_steps.rb +40 -0
- data/features/step_definitions/metric_collector_details_steps.rb +28 -0
- data/features/step_definitions/metric_configuration_steps.rb +61 -0
- data/features/step_definitions/metric_result_steps.rb +33 -0
- data/features/step_definitions/metric_steps.rb +3 -0
- data/features/step_definitions/module_result_steps.rb +46 -0
- data/features/step_definitions/processing_steps.rb +95 -0
- data/features/step_definitions/project_steps.rb +48 -0
- data/features/step_definitions/range_steps.rb +72 -0
- data/features/step_definitions/reading_group_steps.rb +36 -0
- data/features/step_definitions/reading_steps.rb +47 -0
- data/features/step_definitions/repository_steps.rb +71 -0
- data/features/support/env.rb +25 -0
- data/features/support/kalibro_cucumber_helpers.yml.sample +3 -0
- data/kalibro_client.gemspec +49 -0
- data/lib/kalibro_client.rb +62 -0
- data/lib/kalibro_client/entities.rb +40 -0
- data/lib/kalibro_client/entities/base.rb +196 -0
- data/lib/kalibro_client/entities/configurations/base.rb +13 -0
- data/lib/kalibro_client/entities/configurations/kalibro_configuration.rb +37 -0
- data/lib/kalibro_client/entities/configurations/kalibro_range.rb +77 -0
- data/lib/kalibro_client/entities/configurations/metric_configuration.rb +93 -0
- data/lib/kalibro_client/entities/configurations/range_snapshot.rb +37 -0
- data/lib/kalibro_client/entities/configurations/reading.rb +56 -0
- data/lib/kalibro_client/entities/configurations/reading_group.rb +34 -0
- data/lib/kalibro_client/entities/miscellaneous/base.rb +57 -0
- data/lib/kalibro_client/entities/miscellaneous/compound_metric.rb +21 -0
- data/lib/kalibro_client/entities/miscellaneous/date_metric_result.rb +14 -0
- data/lib/kalibro_client/entities/miscellaneous/date_module_result.rb +18 -0
- data/lib/kalibro_client/entities/miscellaneous/granularity.rb +54 -0
- data/lib/kalibro_client/entities/miscellaneous/metric.rb +19 -0
- data/lib/kalibro_client/entities/miscellaneous/native_metric.rb +24 -0
- data/lib/kalibro_client/entities/processor/base.rb +16 -0
- data/lib/kalibro_client/entities/processor/kalibro_module.rb +27 -0
- data/lib/kalibro_client/entities/processor/metric_collector_details.rb +53 -0
- data/lib/kalibro_client/entities/processor/metric_result.rb +79 -0
- data/lib/kalibro_client/entities/processor/module_result.rb +82 -0
- data/lib/kalibro_client/entities/processor/process_time.rb +31 -0
- data/lib/kalibro_client/entities/processor/processing.rb +109 -0
- data/lib/kalibro_client/entities/processor/project.rb +34 -0
- data/lib/kalibro_client/entities/processor/repository.rb +75 -0
- data/lib/kalibro_client/errors.rb +18 -0
- data/lib/kalibro_client/errors/record_not_found.rb +22 -0
- data/lib/kalibro_client/errors/standard.rb +24 -0
- data/lib/kalibro_client/helpers/aggregation_options.rb +25 -0
- data/lib/kalibro_client/helpers/hash_converters.rb +48 -0
- data/lib/kalibro_client/helpers/request_methods.rb +55 -0
- data/lib/kalibro_client/helpers/xml_converters.rb +20 -0
- data/lib/kalibro_client/kalibro_cucumber_helpers.rb +60 -0
- data/lib/kalibro_client/kalibro_cucumber_helpers/configuration.rb +30 -0
- data/lib/kalibro_client/kalibro_cucumber_helpers/hooks.rb +25 -0
- data/lib/kalibro_client/version.rb +19 -0
- data/lib/rake/test_task.rb +57 -0
- data/spec/entities/base_spec.rb +313 -0
- data/spec/entities/configurations/base_spec.rb +26 -0
- data/spec/entities/configurations/kalibro_configuration_spec.rb +91 -0
- data/spec/entities/configurations/kalibro_range_spec.rb +174 -0
- data/spec/entities/configurations/metric_configuration_spec.rb +230 -0
- data/spec/entities/configurations/range_snapshot_spec.rb +50 -0
- data/spec/entities/configurations/reading_group_spec.rb +60 -0
- data/spec/entities/configurations/reading_spec.rb +87 -0
- data/spec/entities/miscellaneous/base_spec.rb +49 -0
- data/spec/entities/miscellaneous/compound_metric_spec.rb +36 -0
- data/spec/entities/miscellaneous/date_metric_result_spec.rb +4 -0
- data/spec/entities/miscellaneous/date_module_result_spec.rb +0 -0
- data/spec/entities/miscellaneous/granularity_spec.rb +96 -0
- data/spec/entities/miscellaneous/metric_spec.rb +15 -0
- data/spec/entities/miscellaneous/native_metric_spec.rb +37 -0
- data/spec/entities/processor/base_spec.rb +26 -0
- data/spec/entities/processor/metric_collector_details_spec.rb +146 -0
- data/spec/entities/processor/metric_result_spec.rb +209 -0
- data/spec/entities/processor/module_result_spec.rb +178 -0
- data/spec/entities/processor/process_time_spec.rb +33 -0
- data/spec/entities/processor/processing_spec.rb +333 -0
- data/spec/entities/processor/project_spec.rb +68 -0
- data/spec/entities/processor/repository_spec.rb +140 -0
- data/spec/factories/date_metric_results.rb +30 -0
- data/spec/factories/date_module_results.rb +24 -0
- data/spec/factories/granularities.rb +23 -0
- data/spec/factories/kalibro_configurations.rb +34 -0
- data/spec/factories/kalibro_module.rb +28 -0
- data/spec/factories/kalibro_ranges.rb +40 -0
- data/spec/factories/metric_collector_details.rb +30 -0
- data/spec/factories/metric_configurations.rb +31 -0
- data/spec/factories/metric_results.rb +24 -0
- data/spec/factories/metrics.rb +48 -0
- data/spec/factories/models.rb +23 -0
- data/spec/factories/module_results.rb +43 -0
- data/spec/factories/process_times.rb +27 -0
- data/spec/factories/processings.rb +24 -0
- data/spec/factories/projects.rb +35 -0
- data/spec/factories/ranges_snapshot.rb +26 -0
- data/spec/factories/reading_groups.rb +28 -0
- data/spec/factories/readings.rb +30 -0
- data/spec/factories/repositories.rb +39 -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 +112 -0
- data/spec/savon/fixtures/config.yml +2 -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 +111 -0
- metadata +479 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
Feature: Save
|
2
|
+
In order to be able to use ranges
|
3
|
+
As a developer
|
4
|
+
I want to save it on kalibro database
|
5
|
+
|
6
|
+
@kalibro_configuration_restart
|
7
|
+
Scenario: When there is a metric configuration
|
8
|
+
Given I have a configuration with name "Java"
|
9
|
+
And I have a reading group with name "Group"
|
10
|
+
And I have a metric configuration within the given configuration
|
11
|
+
And I have a reading within the given reading group
|
12
|
+
And I have an unsaved range within the given reading
|
13
|
+
When I ask to save the given range
|
14
|
+
Then the id of the given range should be set
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Feature: Reading destruction
|
2
|
+
In order to be able to manipulate readings
|
3
|
+
As a developer
|
4
|
+
I want to destroy a given reading
|
5
|
+
|
6
|
+
@kalibro_configuration_restart
|
7
|
+
Scenario: With an existing reading
|
8
|
+
Given I have a reading group with name "RG"
|
9
|
+
And the given reading group has the following readings:
|
10
|
+
| label | grade | color |
|
11
|
+
| "Awesome" | 10 | 3333ff |
|
12
|
+
When I destroy the reading
|
13
|
+
Then the reading should no longer exist
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Feature: Reading listing
|
2
|
+
In order to be able to check if a reading still exists
|
3
|
+
As a developer
|
4
|
+
I want to check that on the service
|
5
|
+
|
6
|
+
@kalibro_configuration_restart
|
7
|
+
Scenario: With an existing reading
|
8
|
+
Given I have a reading group with name "RG"
|
9
|
+
And the given reading group has the following readings:
|
10
|
+
| label | grade | color |
|
11
|
+
| "Awesome" | 10 | 3333ff |
|
12
|
+
When I ask to check if the given reading exists
|
13
|
+
Then I should get true
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Feature: Find
|
2
|
+
In order to be able to have readings
|
3
|
+
As a developer
|
4
|
+
I want to find a given reading
|
5
|
+
|
6
|
+
@kalibro_configuration_restart
|
7
|
+
Scenario: find a valid reading
|
8
|
+
Given I have a reading group with name "Kalibro"
|
9
|
+
And I have a reading within the given reading group
|
10
|
+
When I ask for a reading with the same id of the given reading
|
11
|
+
Then I should get the given reading
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Feature: Readings Of
|
2
|
+
In order to be able to have readings
|
3
|
+
As a developer
|
4
|
+
I want to get the readings of the given reading group
|
5
|
+
|
6
|
+
@kalibro_configuration_restart
|
7
|
+
Scenario: readings of a valid reading group
|
8
|
+
Given I have a reading group with name "Kalibro"
|
9
|
+
And I have a reading within the given reading group
|
10
|
+
When I ask for the readings of the given reading group
|
11
|
+
Then I should get a list with the given reading
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Feature: All
|
2
|
+
In order to be able to have reading groups
|
3
|
+
As a developer
|
4
|
+
I want to get all the available reading groups
|
5
|
+
|
6
|
+
@kalibro_configuration_restart
|
7
|
+
Scenario: one reading group
|
8
|
+
Given I have a reading group with name "Kalibro"
|
9
|
+
When I ask for all the reading groups
|
10
|
+
Then I should get a list with the given reading group
|
@@ -0,0 +1,9 @@
|
|
1
|
+
Feature: Creation
|
2
|
+
In order to be able to have reading groups
|
3
|
+
As a developer
|
4
|
+
I want to create a reading group
|
5
|
+
|
6
|
+
@kalibro_configuration_restart
|
7
|
+
Scenario: creating a reading group
|
8
|
+
When I create a reading group with name "Kalibro"
|
9
|
+
Then the reading group should exist
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Feature: Destroy
|
2
|
+
In order to manipulate reading groups
|
3
|
+
As a developer
|
4
|
+
I want to destroy a given reading group
|
5
|
+
|
6
|
+
@kalibro_configuration_restart
|
7
|
+
Scenario: destroying a valid reading group
|
8
|
+
Given I have a reading group with name "Kalibro"
|
9
|
+
When I destroy the reading group
|
10
|
+
Then the reading group should no longer exist
|
11
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Feature: Repositories listing
|
2
|
+
In order to be able to visualize repositories
|
3
|
+
As a developer
|
4
|
+
I want to see all the repositories on the service
|
5
|
+
|
6
|
+
@kalibro_processor_restart @kalibro_configuration_restart
|
7
|
+
Scenario: With existing project repository
|
8
|
+
Given I have a project with name "Kalibro"
|
9
|
+
And I have a configuration with name "Java"
|
10
|
+
And the given project has the following Repositories:
|
11
|
+
| name | scm_type | address |
|
12
|
+
| Kalibro | GIT | https://git.gitorious.org/sbking/sbking.git |
|
13
|
+
When I ask for all the repositories
|
14
|
+
Then the response should contain the given repository
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Feature: Process
|
2
|
+
In order to be have repositories
|
3
|
+
As a developer
|
4
|
+
I want to cancel the repository processing
|
5
|
+
|
6
|
+
@kalibro_processor_restart @kalibro_configuration_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 the given project has the following Repositories:
|
11
|
+
| name | scm_type | address |
|
12
|
+
| Kalibro | GIT | https://git.gitorious.org/sbking/sbking.git |
|
13
|
+
When I call the cancel_process method for the given repository
|
14
|
+
Then I should get success
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Feature: Repositories destroying
|
2
|
+
In order to manipulate repositories
|
3
|
+
As a developer
|
4
|
+
I want to destroy a given repository
|
5
|
+
|
6
|
+
@kalibro_processor_restart @kalibro_configuration_restart
|
7
|
+
Scenario: With existing repository
|
8
|
+
Given I have a project with name "Kalibro"
|
9
|
+
And I have a configuration with name "Java"
|
10
|
+
And the given project has the following Repositories:
|
11
|
+
| name | scm_type | address |
|
12
|
+
| Kalibro | GIT | https://git.gitorious.org/sbking/sbking.git |
|
13
|
+
When I destroy the repository
|
14
|
+
Then the repository should no longer exist
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Feature: Repositories listing
|
2
|
+
In order to be able to check know if a repository still exists
|
3
|
+
As a developer
|
4
|
+
I want to check that on the service
|
5
|
+
|
6
|
+
@kalibro_processor_restart @kalibro_configuration_restart
|
7
|
+
Scenario: With existing project repository
|
8
|
+
Given I have a project with name "Kalibro"
|
9
|
+
And I have a configuration with name "Java"
|
10
|
+
And the given project has the following Repositories:
|
11
|
+
| name | scm_type | address |
|
12
|
+
| Kalibro | GIT | https://git.gitorious.org/sbking/sbking.git |
|
13
|
+
When I ask to check if the given repository exists
|
14
|
+
Then I should get true
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Feature: Repositories listing
|
2
|
+
In order to be able to visualize a specific repository
|
3
|
+
As a developer
|
4
|
+
I want to find that repository
|
5
|
+
|
6
|
+
@kalibro_processor_restart @kalibro_configuration_restart
|
7
|
+
Scenario: With existing project repository
|
8
|
+
Given I have a project with name "Kalibro"
|
9
|
+
And I have a configuration with name "Java"
|
10
|
+
And the given project has the following Repositories:
|
11
|
+
| name | scm_type | address |
|
12
|
+
| Kalibro | GIT | https://git.gitorious.org/sbking/sbking.git |
|
13
|
+
When I ask to find the given repository
|
14
|
+
Then I should get the given repository
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Feature: Repositories listing
|
2
|
+
In order to be able to visualize repositories
|
3
|
+
As a developer
|
4
|
+
I want to see all the repository from a given project
|
5
|
+
|
6
|
+
@kalibro_processor_restart @kalibro_configuration_restart
|
7
|
+
Scenario: With existing project repository
|
8
|
+
Given I have a project with name "Kalibro"
|
9
|
+
And I have a configuration with name "Java"
|
10
|
+
And the given project has the following Repositories:
|
11
|
+
| name | scm_type | address |
|
12
|
+
| Kalibro | GIT | https://git.gitorious.org/sbking/sbking.git |
|
13
|
+
When I ask for repositories from the given project
|
14
|
+
Then I should get a list with the given repository
|
15
|
+
And the repositories should contain the project id
|
@@ -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_processor_restart @kalibro_configuration_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 loc configuration within the given configuration
|
12
|
+
And the given project has the following Repositories:
|
13
|
+
| name | scm_type | address |
|
14
|
+
| Kalibro | GIT | https://git.gitorious.org/sbking/sbking.git |
|
15
|
+
When I call the process method for the given repository
|
16
|
+
Then I should get success
|
@@ -0,0 +1,40 @@
|
|
1
|
+
Given(/^I have a configuration with name "(.*?)"$/) do |name|
|
2
|
+
@configuration = FactoryGirl.create(:configuration, {name: name})
|
3
|
+
end
|
4
|
+
|
5
|
+
When(/^I get all the configurations$/) do
|
6
|
+
@all_configurations = KalibroClient::Entities::Configurations::KalibroConfiguration.all
|
7
|
+
end
|
8
|
+
|
9
|
+
When(/^I create the configuration with name "(.*?)"$/) do |name|
|
10
|
+
@configuration = FactoryGirl.create(:configuration, {name: name})
|
11
|
+
end
|
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
|
+
Then(/^the configuration should exist$/) do
|
18
|
+
expect(KalibroClient::Entities::Configurations::KalibroConfiguration.exists?(@configuration.id)).to be_truthy
|
19
|
+
end
|
20
|
+
|
21
|
+
When(/^I destroy the configuration$/) do
|
22
|
+
@configuration.destroy
|
23
|
+
end
|
24
|
+
|
25
|
+
Then(/^the configuration should no longer exist$/) do
|
26
|
+
expect(KalibroClient::Entities::Configurations::KalibroConfiguration.exists?(@configuration.id)).to be_falsey
|
27
|
+
end
|
28
|
+
|
29
|
+
Given(/^the configuration has a metric configuration$/) do
|
30
|
+
@metric_configuration = FactoryGirl.create(:metric_configuration, kalibro_configuration_id: @configuration.id)
|
31
|
+
end
|
32
|
+
|
33
|
+
When(/^I list all the metric configurations of the configuration$/) do
|
34
|
+
@metric_configurations = @configuration.metric_configurations
|
35
|
+
end
|
36
|
+
|
37
|
+
Then(/^I should get a list with the given metric configuration$/) do
|
38
|
+
expect(@metric_configurations.include?(@metric_configuration)).to be_truthy
|
39
|
+
end
|
40
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
When(/^I get all metric collector names$/) do
|
2
|
+
@metric_collector_names = KalibroClient::Entities::Processor::MetricCollectorDetails.all_names
|
3
|
+
end
|
4
|
+
|
5
|
+
When(/^I search metric collector Analizo by name$/) do
|
6
|
+
@result = KalibroClient::Entities::Processor::MetricCollectorDetails.find_by_name("Analizo")
|
7
|
+
end
|
8
|
+
|
9
|
+
When(/^I search metric collector Avalio by name$/) do
|
10
|
+
@is_error = false
|
11
|
+
begin
|
12
|
+
KalibroClient::Entities::Processor::MetricCollectorDetails.find_by_name("Avalio")
|
13
|
+
rescue KalibroClient::Errors::RecordNotFound
|
14
|
+
@is_error = true
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
Then(/^it should return Analizo string inside of an array$/) do
|
19
|
+
expect(@metric_collector_names.include?("Analizo")).to be_truthy
|
20
|
+
end
|
21
|
+
|
22
|
+
Then(/^I should get Analizo metric collector$/) do
|
23
|
+
expect(@result.name).to eq("Analizo")
|
24
|
+
end
|
25
|
+
|
26
|
+
Then(/^I should get an error$/) do
|
27
|
+
expect(@is_error).to be_truthy
|
28
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
Given(/^I have a metric configuration within the given configuration$/) do
|
2
|
+
@metric_configuration = FactoryGirl.create(:metric_configuration,
|
3
|
+
{reading_group_id: @reading_group.id,
|
4
|
+
kalibro_configuration_id: @configuration.id})
|
5
|
+
end
|
6
|
+
|
7
|
+
Given(/^I have a metric configuration within the given configuration with the given metric$/) do
|
8
|
+
@metric_configuration = FactoryGirl.create(:metric_configuration,
|
9
|
+
{metric: @metric,
|
10
|
+
reading_group_id: @reading_group.id,
|
11
|
+
kalibro_configuration_id: @configuration.id})
|
12
|
+
end
|
13
|
+
|
14
|
+
Given(/^I have a loc configuration within the given configuration$/) do
|
15
|
+
@metric_configuration = FactoryGirl.create(:metric_configuration,
|
16
|
+
{metric: FactoryGirl.build(:loc),
|
17
|
+
reading_group_id: @reading_group.id,
|
18
|
+
kalibro_configuration_id: @configuration.id})
|
19
|
+
end
|
20
|
+
|
21
|
+
When(/^I search a metric configuration with the same id of the given metric configuration$/) do
|
22
|
+
@found_metric_configuration = KalibroClient::Entities::Configurations::MetricConfiguration.find(@metric_configuration.id)
|
23
|
+
end
|
24
|
+
|
25
|
+
When(/^I search an inexistent metric configuration$/) do
|
26
|
+
@is_error = false
|
27
|
+
inexistent_id = rand(Time.now.to_i)
|
28
|
+
begin
|
29
|
+
KalibroClient::Entities::Configurations::MetricConfiguration.find(inexistent_id)
|
30
|
+
rescue KalibroClient::Errors::RecordNotFound
|
31
|
+
@is_error = true
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
When(/^I request all metric configurations of the given configuration$/) do
|
36
|
+
@metric_configurations = KalibroClient::Entities::Configurations::MetricConfiguration.metric_configurations_of(@configuration.id)
|
37
|
+
end
|
38
|
+
|
39
|
+
Then(/^it should return the same metric configuration as the given one$/) do
|
40
|
+
expect(@found_metric_configuration).to eq(@metric_configuration)
|
41
|
+
end
|
42
|
+
|
43
|
+
Then(/^I should get a list of its metric configurations$/) do
|
44
|
+
expect(@metric_configurations).to eq([@metric_configuration])
|
45
|
+
end
|
46
|
+
|
47
|
+
Then(/^I should get an empty list of metric configurations$/) do
|
48
|
+
expect(@metric_configurations).to eq([])
|
49
|
+
end
|
50
|
+
|
51
|
+
When(/^I destroy the metric configuration$/) do
|
52
|
+
@metric_configuration.destroy
|
53
|
+
end
|
54
|
+
|
55
|
+
Then(/^the metric configuration should no longer exist$/) do
|
56
|
+
expect { KalibroClient::Entities::Configurations::MetricConfiguration.find(@metric_configuration.id) }.to raise_error(KalibroClient::Errors::RecordNotFound)
|
57
|
+
end
|
58
|
+
|
59
|
+
Then(/^the metric configuration should exist$/) do
|
60
|
+
expect(KalibroClient::Entities::Configurations::MetricConfiguration.find(@metric_configuration.id)).to eq(@metric_configuration)
|
61
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
When(/^I call the metric results of method with the results root id of the given processing$/) do
|
2
|
+
@response = KalibroClient::Entities::Processor::MetricResult.metric_results_of(@response.root_module_result_id)
|
3
|
+
end
|
4
|
+
|
5
|
+
Given(/^I search a metric result with descendant values for the given metric result$/) do
|
6
|
+
first_module_result = KalibroClient::Entities::Processor::ModuleResult.find(@response.root_module_result_id)
|
7
|
+
|
8
|
+
metric_results = KalibroClient::Entities::Processor::MetricResult.metric_results_of(first_module_result.id)
|
9
|
+
@response = metric_results.first.descendant_values
|
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 = KalibroClient::Entities::Processor::MetricResult.history_of(@metric.name, @response.root_module_result_id, @repository.id)
|
14
|
+
end
|
15
|
+
|
16
|
+
Then (/^I should get a Float list$/) do
|
17
|
+
expect(@response).to be_a(Array)
|
18
|
+
expect(@response.first).to be_a(Float)
|
19
|
+
end
|
20
|
+
|
21
|
+
Then(/^I should get a list of metric results$/) do
|
22
|
+
expect(@response).to be_a(Array)
|
23
|
+
expect(@response.first).to be_a(KalibroClient::Entities::Processor::MetricResult)
|
24
|
+
end
|
25
|
+
|
26
|
+
Then(/^I should get a list of date metric results$/) do
|
27
|
+
expect(@response).to be_a(Array)
|
28
|
+
expect(@response.first).to be_a(KalibroClient::Entities::Miscellaneous::DateMetricResult)
|
29
|
+
end
|
30
|
+
|
31
|
+
Then(/^the first metric result should have a metric configuration$/) do
|
32
|
+
expect(@response.first.metric_configuration).to be_a(KalibroClient::Entities::Configurations::MetricConfiguration)
|
33
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
When(/^I ask a module result with the same id of the given module result$/) do
|
2
|
+
@found_module_result = KalibroClient::Entities::Processor::ModuleResult.find(@module_result.id)
|
3
|
+
end
|
4
|
+
|
5
|
+
When(/^I ask for an inexistent module result$/) do
|
6
|
+
@is_error = false
|
7
|
+
begin
|
8
|
+
KalibroClient::Entities::Processor::ModuleResult.find(-1)
|
9
|
+
rescue KalibroClient::Errors::RecordNotFound
|
10
|
+
@is_error = true
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
When(/^I ask for the children of the processing root module result$/) do
|
15
|
+
@children = KalibroClient::Entities::Processor::ModuleResult.
|
16
|
+
find(KalibroClient::Entities::Processor::Processing.processing_of(@repository.id).root_module_result_id).children
|
17
|
+
end
|
18
|
+
|
19
|
+
Then(/^I should get a list with the children module results$/) do
|
20
|
+
expect(@children.first).to be_a(KalibroClient::Entities::Processor::ModuleResult)
|
21
|
+
end
|
22
|
+
|
23
|
+
Then(/^I should get the given module result$/) do
|
24
|
+
expect(@found_module_result).to eq(@module_result)
|
25
|
+
end
|
26
|
+
|
27
|
+
Given(/^I get the module result of the processing$/) do
|
28
|
+
@module_result = KalibroClient::Entities::Processor::ModuleResult.
|
29
|
+
find(KalibroClient::Entities::Processor::Processing.processing_of(@repository.id).root_module_result_id)
|
30
|
+
end
|
31
|
+
|
32
|
+
When(/^I ask for the history of the given module result$/) do
|
33
|
+
@history = KalibroClient::Entities::Processor::ModuleResult.history_of(@module_result.id)
|
34
|
+
end
|
35
|
+
|
36
|
+
Then(/^I should get a list with date module results$/) do
|
37
|
+
expect(@history).to be_a(Array)
|
38
|
+
end
|
39
|
+
|
40
|
+
Then(/^I should get a module_result$/) do
|
41
|
+
expect(@module_result).to be_a(KalibroClient::Entities::Processor::ModuleResult)
|
42
|
+
end
|
43
|
+
|
44
|
+
Then(/^The first children should have a module$/) do
|
45
|
+
expect(@children.first.kalibro_module).to be_a(KalibroClient::Entities::Processor::KalibroModule)
|
46
|
+
end
|