Commit 13629abb52750b6d83ec8e901b5fc825a9e012e2
Committed by
Rafael Manzo
1 parent
56e45f23
Exists in
colab
and in
4 other branches
Acceptance test for modules tree using MetricFu
Signed off by: Rafael Manzo <rr.manzo@gmail.com>
Showing
6 changed files
with
60 additions
and
2 deletions
Show diff stats
features/repository/show/modules_tree.feature
| ... | ... | @@ -38,7 +38,7 @@ Feature: Repository modules tree |
| 38 | 38 | And I should see "Granularity" |
| 39 | 39 | And I should see "Grade" |
| 40 | 40 | |
| 41 | - # This test is broken under analizo 1.17.0: https://www.pivotaltracker.com/story/show/80377258 | |
| 41 | + # This test is broken under analizo 1.17.0: https://www.pivotaltracker.com/story/show/80377258 | |
| 42 | 42 | @wip @kalibro_configuration_restart @kalibro_processor_restart @javascript |
| 43 | 43 | Scenario: Module navigation |
| 44 | 44 | Given I am a regular user |
| ... | ... | @@ -55,3 +55,19 @@ Feature: Repository modules tree |
| 55 | 55 | And I click on the sample child's name |
| 56 | 56 | And I wait for "5" seconds |
| 57 | 57 | Then I should see a sample child's name |
| 58 | + | |
| 59 | + @kalibro_configuration_restart @kalibro_processor_restart @javascript @wip | |
| 60 | + Scenario: Should show modules directories root when the process has been finished | |
| 61 | + Given I am a regular user | |
| 62 | + And I am signed in | |
| 63 | + And I have a sample project | |
| 64 | + And I have a sample configuration with MetricFu metrics | |
| 65 | + And I have a sample ruby repository within the sample project | |
| 66 | + And I start to process that repository | |
| 67 | + And I wait up for a ready processing | |
| 68 | + And I ask for the last ready processing of the given repository | |
| 69 | + And I ask for the module result of the given processing | |
| 70 | + When I visit the repository show page | |
| 71 | + And I click the "Modules Tree" h3 | |
| 72 | + And I wait for "5" seconds | |
| 73 | + Then I should see the given module result | ... | ... |
features/step_definitions/kalibro_configuration_steps.rb
features/step_definitions/metric_configuration_steps.rb
| ... | ... | @@ -8,6 +8,17 @@ Given(/^I have a metric configuration with code "(.*?)" within the given mezuro |
| 8 | 8 | {kalibro_configuration_id: @kalibro_configuration.id, reading_group_id: @reading_group.id, metric: FactoryGirl.build(:metric, code: code)}) |
| 9 | 9 | end |
| 10 | 10 | |
| 11 | +Given(/^I have a sample configuration with MetricFu metrics$/) do | |
| 12 | + reading_group = FactoryGirl.create(:reading_group) | |
| 13 | + reading = FactoryGirl.create(:reading, {reading_group_id: reading_group.id}) | |
| 14 | + | |
| 15 | + @kalibro_configuration = FactoryGirl.create(:kalibro_configuration) | |
| 16 | + metric_configuration = FactoryGirl.create(:metric_configuration, | |
| 17 | + {metric: FactoryGirl.build(:pain), | |
| 18 | + reading_group_id: reading_group.id, | |
| 19 | + kalibro_configuration_id: @kalibro_configuration.id}) | |
| 20 | +end | |
| 21 | + | |
| 11 | 22 | When(/^I visit the sample metric configuration edit page$/) do |
| 12 | 23 | visit edit_kalibro_configuration_metric_configuration_path(@metric_configuration.kalibro_configuration_id, @metric_configuration.id) |
| 13 | 24 | end |
| ... | ... | @@ -40,3 +51,4 @@ end |
| 40 | 51 | Then(/^I should be at the choose metric page$/) do |
| 41 | 52 | expect(page).to have_content("Choose a metric from a Base Tool:") |
| 42 | 53 | end |
| 54 | + | ... | ... |
features/step_definitions/repository_steps.rb
| ... | ... | @@ -26,6 +26,11 @@ Given(/^I have a sample repository within the sample project$/) do |
| 26 | 26 | kalibro_configuration_id: @kalibro_configuration.id, id: nil}) |
| 27 | 27 | end |
| 28 | 28 | |
| 29 | +Given(/^I have a sample ruby repository within the sample project$/) do | |
| 30 | + @repository = FactoryGirl.create(:ruby_repository, {project_id: @project.id, | |
| 31 | + kalibro_configuration_id: @kalibro_configuration.id, id: nil}) | |
| 32 | +end | |
| 33 | + | |
| 29 | 34 | Given(/^I have a sample repository within the sample project named "(.+)"$/) do |name| |
| 30 | 35 | @repository = FactoryGirl.create(:repository, {project_id: @project.id, |
| 31 | 36 | kalibro_configuration_id: @kalibro_configuration.id, id: nil, name: name}) |
| ... | ... | @@ -169,3 +174,4 @@ Then(/^"(.*?)" should be lesser than "(.*?)"$/) do |arg1, arg2| |
| 169 | 174 | |
| 170 | 175 | expect(v1 < v2).to be_truthy |
| 171 | 176 | end |
| 177 | + | ... | ... |
spec/factories/metrics.rb
| ... | ... | @@ -21,6 +21,17 @@ FactoryGirl.define do |
| 21 | 21 | initialize_with { new(name, code, scope, description, languages) } |
| 22 | 22 | end |
| 23 | 23 | |
| 24 | + factory :pain, class: KalibroClient::Entities::Miscellaneous::NativeMetric do | |
| 25 | + name "Code Pain" | |
| 26 | + code "pain" | |
| 27 | + scope "CLASS" | |
| 28 | + description nil | |
| 29 | + languages { [:ruby] } | |
| 30 | + metric_collector_name "MetricFu" | |
| 31 | + | |
| 32 | + initialize_with { new(name, code, scope, description, languages) } | |
| 33 | + end | |
| 34 | + | |
| 24 | 35 | factory :compound_metric, class: KalibroClient::Entities::Miscellaneous::CompoundMetric do |
| 25 | 36 | name "Compound" |
| 26 | 37 | code "compound" | ... | ... |
spec/factories/repositories.rb
| ... | ... | @@ -27,6 +27,19 @@ FactoryGirl.define do |
| 27 | 27 | send_email "test@test.com" |
| 28 | 28 | end |
| 29 | 29 | |
| 30 | + factory :ruby_repository, class: Repository do | |
| 31 | + id 2 | |
| 32 | + name "KalibroConfigurations" | |
| 33 | + description "Kalibro Configurations" | |
| 34 | + license "GPLv3" | |
| 35 | + period 1 | |
| 36 | + scm_type "GIT" | |
| 37 | + address "https://github.com/mezuro/kalibro_processor.git" | |
| 38 | + kalibro_configuration_id 1 | |
| 39 | + project_id 1 | |
| 40 | + send_email "test@test.com" | |
| 41 | + end | |
| 42 | + | |
| 30 | 43 | factory :another_repository, parent: :repository do |
| 31 | 44 | id 2 |
| 32 | 45 | end | ... | ... |