From 7a1820e6873416b33cdca27a8af9632952f45b68 Mon Sep 17 00:00:00 2001 From: Heitor Reis Date: Thu, 22 Oct 2015 15:11:08 -0200 Subject: [PATCH] List hotspot metric configurations --- app/views/kalibro_configurations/_metric_configurations.html.erb | 2 +- app/views/kalibro_configurations/_no_metric_configurations.html.erb | 6 ++++-- app/views/kalibro_configurations/show.html.erb | 7 ++++--- config/locales/views/metric_configurations/en.yml | 3 ++- config/locales/views/metric_configurations/pt.yml | 3 ++- features/compound_metric_configuration/create.feature | 2 +- features/compound_metric_configuration/edition.feature | 8 ++++---- features/hotspot_metric_configuration/listing.feature | 24 ++++++++++++++++++++++++ features/kalibro_range/create.feature | 24 ++++++++++++------------ features/kalibro_range/deletion.feature | 8 ++++---- features/kalibro_range/edit.feature | 8 ++++---- features/step_definitions/kalibro_range_steps.rb | 4 ++-- features/step_definitions/metric_configuration_steps.rb | 15 +++++++++++++-- features/tree_metric_configuration/delete.feature | 6 +++--- features/tree_metric_configuration/edition.feature | 10 +++++----- features/tree_metric_configuration/listing.feature | 15 ++++++++------- features/tree_metric_configuration/show.feature | 8 ++++---- 17 files changed, 97 insertions(+), 56 deletions(-) create mode 100644 features/hotspot_metric_configuration/listing.feature diff --git a/app/views/kalibro_configurations/_metric_configurations.html.erb b/app/views/kalibro_configurations/_metric_configurations.html.erb index 5d1ed23..cccd74e 100644 --- a/app/views/kalibro_configurations/_metric_configurations.html.erb +++ b/app/views/kalibro_configurations/_metric_configurations.html.erb @@ -1,7 +1,7 @@ <%= metric_configuration.metric.name %> + <%= metric_configuration.metric.code %> <% unless metric_configuration.metric.is_a? KalibroClient::Entities::Miscellaneous::HotspotMetric %> - <%= metric_configuration.metric.code %> <%= metric_configuration.weight %> <% end %> diff --git a/app/views/kalibro_configurations/_no_metric_configurations.html.erb b/app/views/kalibro_configurations/_no_metric_configurations.html.erb index d9e6667..2457bef 100644 --- a/app/views/kalibro_configurations/_no_metric_configurations.html.erb +++ b/app/views/kalibro_configurations/_no_metric_configurations.html.erb @@ -1,4 +1,6 @@ <% col_number = kalibro_configuration_owner?(@kalibro_configuration.id) ? 5 : 3 %> - <%= t('no_metric_configurations') %> - \ No newline at end of file + + <%= t(message) %> + + diff --git a/app/views/kalibro_configurations/show.html.erb b/app/views/kalibro_configurations/show.html.erb index a99fda8..f943531 100644 --- a/app/views/kalibro_configurations/show.html.erb +++ b/app/views/kalibro_configurations/show.html.erb @@ -25,7 +25,7 @@ <% if Rails.cache.read("#{@kalibro_configuration.id}_tree_metric_configurations").empty? %> - <%= render partial: 'no_metric_configurations' %> + <%= render partial: 'no_metric_configurations', locals: { message: 'no_tree_metric_configurations' } %> <% else %> <%= render partial: 'metric_configurations', collection: Rails.cache.read("#{@kalibro_configuration.id}_tree_metric_configurations"), as: :metric_configuration %> <% end %> @@ -42,12 +42,13 @@ <%= t('metric') %> - + <%= t('code') %> + <% if Rails.cache.read("#{@kalibro_configuration.id}_hotspot_metric_configurations").empty? %> - <%= render partial: 'no_metric_configurations' %> + <%= render partial: 'no_metric_configurations', locals: { message: 'no_hotspot_metric_configurations' } %> <% else %> <%= render partial: 'metric_configurations', collection: Rails.cache.read("#{@kalibro_configuration.id}_hotspot_metric_configurations"), as: :metric_configuration %> <% end %> diff --git a/config/locales/views/metric_configurations/en.yml b/config/locales/views/metric_configurations/en.yml index f720452..de25b80 100644 --- a/config/locales/views/metric_configurations/en.yml +++ b/config/locales/views/metric_configurations/en.yml @@ -23,7 +23,8 @@ en: metric_configurations_base_tool_name: "Base Tool Name:" metric_configurations_aggregation: "Aggregation Form" metric_configurations_reading_group: "Reading Group Name" - no_metric_configurations: "There are no Metric Configurations yet!" + no_tree_metric_configurations: "There are no Tree Metric Configurations yet!" + no_hotspot_metric_configurations: "There are no Hotspot Metric Configurations yet!" destroy_metric_configuration: "Destroy Metric Configuration" want_destroy_metric_configuration: "Are you sure that you want to destroy this Metric Configuration?" metric_base_tool_name: "Base Tool Name" diff --git a/config/locales/views/metric_configurations/pt.yml b/config/locales/views/metric_configurations/pt.yml index 7404f3b..7a8e613 100644 --- a/config/locales/views/metric_configurations/pt.yml +++ b/config/locales/views/metric_configurations/pt.yml @@ -27,7 +27,8 @@ pt: metric_configurations_base_tool_name: "Nome da ferramenta base:" metric_configurations_aggregation: "Forma de Agregação" metric_configurations_reading_group: "Nome do grupo" - no_metric_configurations: "Não há configurações de métricas ainda!" + no_tree_metric_configurations: "Não há configurações de métricas escalares ainda!" + no_hotspot_metric_configurations: "Não há configurações de métricas de Hotspot ainda!" destroy_metric_configuration: "Destruir Configuração de Métrica" want_destroy_metric_configuration: "Tem certeza que você quer destruir esta Configuração de Métrica?" metric_base_tool_name: "Coletor" diff --git a/features/compound_metric_configuration/create.feature b/features/compound_metric_configuration/create.feature index 0cfa918..5a24849 100644 --- a/features/compound_metric_configuration/create.feature +++ b/features/compound_metric_configuration/create.feature @@ -9,7 +9,7 @@ Feature: Compound Metric Configuration Creation And I am signed in And I own a sample configuration And I have a reading group named "Scholar" - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration And I am at the Sample Configuration page And I click the Add Metric link And I click the Compound Metric link diff --git a/features/compound_metric_configuration/edition.feature b/features/compound_metric_configuration/edition.feature index c3b6308..ae515e0 100644 --- a/features/compound_metric_configuration/edition.feature +++ b/features/compound_metric_configuration/edition.feature @@ -9,7 +9,7 @@ Feature: Compound Metric Configuration edition And I am signed in And I have a sample configuration And I have a sample reading group - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration And I have a sample compound metric configuration within the given mezuro configuration When I am at the Sample Configuration page Then I should not find "Edit" within "table#tree_metric_configurations" @@ -20,7 +20,7 @@ Feature: Compound Metric Configuration edition And I am signed in And I own a sample configuration And I have a sample reading group - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration And I have a sample compound metric configuration within the given mezuro configuration And I am at the Sample Configuration page When I click the edit link of the Coumpound Metric @@ -36,7 +36,7 @@ Feature: Compound Metric Configuration edition And I am signed in And I own a sample configuration And I have a sample reading group - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration And I have a sample compound metric configuration within the given mezuro configuration When I visit the sample compound metric configuration edit page And I fill the Name field with " " @@ -57,7 +57,7 @@ Feature: Compound Metric Configuration edition And I am signed in And I own a sample configuration And I have a sample reading group - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration And I have a sample compound metric configuration within the given mezuro configuration And I have another compound metric configuration with code "Another_Code" within the given mezuro configuration When I visit the sample compound metric configuration edit page diff --git a/features/hotspot_metric_configuration/listing.feature b/features/hotspot_metric_configuration/listing.feature new file mode 100644 index 0000000..a8928eb --- /dev/null +++ b/features/hotspot_metric_configuration/listing.feature @@ -0,0 +1,24 @@ +Feature: Hotspot Configuration listing + In order to interact with hotspot metric configurations + As a regular user + I should see the hotspot metric configurations of a given kalibro configuration + + @kalibro_configuration_restart @javascript @wip + Scenario: When there are hotspot metric configurations and no tree metric configurations + Given I have a sample configuration + And I have a sample hotspot metric configuration within the given mezuro configuration + When I am at the Sample Configuration page + Then I should see the sample hotspot metric configuration content + And I take a picture of the page + And I should see "There are no Tree Metric Configurations yet!" + + + @kalibro_configuration_restart @wip + Scenario: When there are hotspot metric configurations and tree metric configurations + Given I have a sample configuration + And I have a sample hotspot metric configuration within the given mezuro configuration + And I have a sample reading group + And I have a sample tree metric configuration within the given mezuro configuration + When I am at the Sample Configuration page + Then I should see the sample hotspot metric configuration content + And I should not see "There are no Tree Metric Configurations yet!" diff --git a/features/kalibro_range/create.feature b/features/kalibro_range/create.feature index ac21145..3fcd0f6 100644 --- a/features/kalibro_range/create.feature +++ b/features/kalibro_range/create.feature @@ -9,7 +9,7 @@ Feature: Create Kalibro Range And I am signed in And I own a sample configuration And I own a sample reading group - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration And I have a sample reading within the sample reading group labeled "My Reading" And I am at the sample metric configuration page When I click the Add Range link @@ -25,7 +25,7 @@ Feature: Create Kalibro Range And I am signed in And I own a sample configuration And I have a reading group named "Scholar" - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration And I am at the sample metric configuration page When I click the Add Range link Then I should be at the New Range page @@ -41,7 +41,7 @@ Feature: Create Kalibro Range And I am signed in And I own a sample configuration And I own a sample reading group - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration And I am at the sample metric configuration page When I click the Add Range link Then I should be at the New Range page @@ -61,7 +61,7 @@ Feature: Create Kalibro Range And I am signed in And I own a sample configuration And I own a sample reading group - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration And I have a sample reading within the sample reading group labeled "My Reading" And I am at the New Range page And I fill the Beginning field with "42" @@ -77,7 +77,7 @@ Feature: Create Kalibro Range And I am signed in And I own a sample configuration And I own a sample reading group - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration And I have a sample reading within the sample reading group labeled "My Reading" And I am at the New Range page And I fill the Beginning field with "666" @@ -95,7 +95,7 @@ Feature: Create Kalibro Range And I am signed in And I own a sample configuration And I own a sample reading group - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration And I have a sample reading within the sample reading group labeled "My Reading" And I am at the New Range page And I fill the Beginning field with "z" @@ -113,7 +113,7 @@ Feature: Create Kalibro Range And I am signed in And I own a sample configuration And I own a sample reading group - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration And I have a sample reading within the sample reading group labeled "My Reading" And I am at the New Range page And I fill the Beginning field with "-1" @@ -131,9 +131,9 @@ Feature: Create Kalibro Range And I am signed in And I own a sample configuration And I own a sample reading group - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration And I have a sample reading within the sample reading group labeled "My Reading" - And I have a sample range within the sample metric configuration with beginning "2" + And I have a sample range within the sample tree metric configuration with beginning "2" And I am at the New Range page And I fill the Beginning field with "2" And I fill the End field with "666" @@ -151,7 +151,7 @@ Feature: Create Kalibro Range And I am signed in And I own a sample configuration And I own a sample reading group - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration And I have a sample reading within the sample reading group labeled "My Reading" And I am at the New Range page And I click the -∞ link @@ -169,7 +169,7 @@ Feature: Create Kalibro Range And I am signed in And I own a sample configuration And I own a sample reading group - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration And I have a sample reading within the sample reading group labeled "My Reading" And I am at the New Range page And I fill the Beginning field with "2" @@ -193,7 +193,7 @@ Feature: Create Kalibro Range And I am signed in And I own a sample configuration And I own a sample reading group - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration And I have a sample compound metric configuration within the given mezuro configuration And I have a sample reading within the sample reading group labeled "My Reading" And I am at the New Range page for the compound metric configuration diff --git a/features/kalibro_range/deletion.feature b/features/kalibro_range/deletion.feature index 0db70a0..d1be66a 100644 --- a/features/kalibro_range/deletion.feature +++ b/features/kalibro_range/deletion.feature @@ -9,9 +9,9 @@ Feature: Kalibro Range Deletion And I am signed in And I own a sample configuration And I have a sample reading group - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration And I have a sample reading within the sample reading group labeled "My Reading" - And I have a sample range within the sample metric configuration + And I have a sample range within the sample tree metric configuration And I am at the sample metric configuration page When I click the Destroy link Then I should be at metric configuration sample page @@ -37,8 +37,8 @@ Feature: Kalibro Range Deletion And I am signed in And I have a sample configuration And I have a sample reading group - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration And I have a sample reading within the sample reading group labeled "My Reading" - And I have a sample range within the sample metric configuration + And I have a sample range within the sample tree metric configuration When I am at the sample metric configuration page Then I should not see "Destroy" diff --git a/features/kalibro_range/edit.feature b/features/kalibro_range/edit.feature index 22b0e05..065ccab 100644 --- a/features/kalibro_range/edit.feature +++ b/features/kalibro_range/edit.feature @@ -9,9 +9,9 @@ Feature: Kalibro Range Edit And I am signed in And I own a sample configuration And I own a sample reading group - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration And I have a sample reading within the sample reading group labeled "My Reading" - And I have a sample range within the sample metric configuration with beginning "1.1" + And I have a sample range within the sample tree metric configuration with beginning "1.1" And I am at the Edit Kalibro Range page And the select field "Reading" is set as "My Reading" And the field "Beginning" should be filled with "1.1" @@ -45,9 +45,9 @@ Feature: Kalibro Range Edit And I am signed in And I own a sample configuration And I own a sample reading group - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration And I have a sample reading within the sample reading group labeled "My Reading" - And I have a sample range within the sample metric configuration with beginning "1" + And I have a sample range within the sample tree metric configuration with beginning "1" And I am at the Edit Kalibro Range page When I fill the Beginning field with " " And I press the Save button diff --git a/features/step_definitions/kalibro_range_steps.rb b/features/step_definitions/kalibro_range_steps.rb index 067d97b..ac50440 100644 --- a/features/step_definitions/kalibro_range_steps.rb +++ b/features/step_definitions/kalibro_range_steps.rb @@ -1,4 +1,4 @@ -Given(/^I have a sample range within the sample metric configuration with beginning "(.*?)"$/) do |beginning| +Given(/^I have a sample range within the sample tree metric configuration with beginning "(.*?)"$/) do |beginning| @kalibro_range = FactoryGirl.create(:kalibro_range, {beginning: beginning, metric_configuration_id: @metric_configuration.id, reading_id: @reading.id}) end @@ -20,7 +20,7 @@ Given(/^the select field "(.*?)" is set as "(.*?)"$/) do |field, text| select text, from: field end -Given(/^I have a sample range within the sample metric configuration$/) do +Given(/^I have a sample range within the sample tree metric configuration$/) do @kalibro_range = FactoryGirl.create(:kalibro_range, {metric_configuration_id: @metric_configuration.id, reading_id: @reading.id}) end diff --git a/features/step_definitions/metric_configuration_steps.rb b/features/step_definitions/metric_configuration_steps.rb index 2ce0012..943fc86 100644 --- a/features/step_definitions/metric_configuration_steps.rb +++ b/features/step_definitions/metric_configuration_steps.rb @@ -1,8 +1,14 @@ -Given(/^I have a sample metric configuration within the given mezuro configuration$/) do +Given(/^I have a sample tree metric configuration within the given mezuro configuration$/) do @metric_configuration = FactoryGirl.create(:metric_configuration_with_id, {kalibro_configuration_id: @kalibro_configuration.id, reading_group_id: @reading_group.id} ) end +Given(/^I have a sample hotspot metric configuration within the given mezuro configuration$/) do + @metric_configuration = FactoryGirl.create(:hotspot_metric_configuration, + kalibro_configuration_id: @kalibro_configuration.id) +end + + Given(/^I have a metric configuration with code "(.*?)" within the given mezuro configuration$/) do |code| @metric_configuration = FactoryGirl.create(:metric_configuration_with_id, {kalibro_configuration_id: @kalibro_configuration.id, reading_group_id: @reading_group.id, metric: FactoryGirl.build(:metric, code: code)}) @@ -51,12 +57,17 @@ Then(/^I am at the sample metric configuration page$/) do expect(page).to have_content("Ranges") end -Then(/^I should see the sample metric configuration content$/) do +Then(/^I should see the sample tree metric configuration content$/) do expect(page).to have_content(@metric_configuration.metric.name) expect(page).to have_content(@metric_configuration.metric.code) expect(page).to have_content(@metric_configuration.weight) end +Then(/^I should see the sample hotspot metric configuration content$/) do + expect(page).to have_content(@metric_configuration.metric.name) + expect(page).to have_content(@metric_configuration.metric.code) +end + Then(/^I should be at metric configuration sample page$/) do expect(page).to have_content(@metric_configuration.metric.name) expect(page).to have_content("Ranges") diff --git a/features/tree_metric_configuration/delete.feature b/features/tree_metric_configuration/delete.feature index 039e98a..de479da 100644 --- a/features/tree_metric_configuration/delete.feature +++ b/features/tree_metric_configuration/delete.feature @@ -9,10 +9,10 @@ Feature: Metric Configuration Deletion And I am signed in And I own a sample configuration And I have a sample reading group - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration When I am at the Sample Configuration page And I click destroy Metric Configuration - Then I should see "There are no Metric Configurations yet!" + Then I should see "There are no Tree Metric Configurations yet!" @kalibro_configuration_restart Scenario: Should not see the destroy metric configuration link in the mezuro configuration that I not own @@ -20,6 +20,6 @@ Feature: Metric Configuration Deletion And I am signed in And I have a sample configuration And I have a sample reading group - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration When I am at the Sample Configuration page Then I should not see "Destroy" diff --git a/features/tree_metric_configuration/edition.feature b/features/tree_metric_configuration/edition.feature index 17eb9ad..7b503bf 100644 --- a/features/tree_metric_configuration/edition.feature +++ b/features/tree_metric_configuration/edition.feature @@ -9,9 +9,9 @@ Feature: Metric Configuration edition And I am signed in And I have a sample configuration And I have a sample reading group - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration When I am at the Sample Configuration page - Then I should not see Edit within table + Then I should not see Edit within table#tree_metric_configurations @kalibro_configuration_restart Scenario: editing a metric configuration successfully @@ -19,7 +19,7 @@ Feature: Metric Configuration edition And I am signed in And I own a sample configuration And I have a sample reading group - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration And I am at the Sample Configuration page When I click the Edit link And I fill the Weight field with "3.0" @@ -32,7 +32,7 @@ Feature: Metric Configuration edition And I am signed in And I own a sample configuration And I have a sample reading group - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration When I visit the sample metric configuration edit page And I fill the Weight field with " " And I press the Save button @@ -44,7 +44,7 @@ Feature: Metric Configuration edition And I am signed in And I own a sample configuration And I have a sample reading group - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration When I visit the sample metric configuration edit page And I fill the Weight field with "0" And I set the select field "Aggregation Form" as "Median" diff --git a/features/tree_metric_configuration/listing.feature b/features/tree_metric_configuration/listing.feature index 53d43db..ef45364 100644 --- a/features/tree_metric_configuration/listing.feature +++ b/features/tree_metric_configuration/listing.feature @@ -1,24 +1,25 @@ -Feature: Configuration listing +Feature: Metric Configuration listing In order to interact with metric configurations As a regular user I should see the metric configurations of a given configuration @kalibro_configuration_restart - Scenario: When there are no metric configurations + Scenario: When there are no tree metric configurations Given I have a sample configuration When I am at the Sample Configuration page Then I should see "Metric" And I should see "Code" And I should see "Weight" - And I should see "There are no Metric Configurations yet!" + And I should see "There are no Tree Metric Configurations yet!" - @kalibro_configuration_restart - Scenario: When there are metric configurations + @kalibro_configuration_restart @wip + Scenario: When there are tree metric configurations and no hotspot metric configurations Given I have a sample configuration And I have a sample reading group - And I have a sample metric configuration within the given mezuro configuration + And I have a sample tree metric configuration within the given mezuro configuration When I am at the Sample Configuration page - Then I should see the sample metric configuration content + Then I should see the sample tree metric configuration content + And I should see "There are no Hotspot Metric Configurations yet!" @kalibro_configuration_restart Scenario: I should see the add metric link when I am the owner of the given configuration diff --git a/features/tree_metric_configuration/show.feature b/features/tree_metric_configuration/show.feature index 40efda1..9cac5f1 100644 --- a/features/tree_metric_configuration/show.feature +++ b/features/tree_metric_configuration/show.feature @@ -8,8 +8,8 @@ Feature: Show Metric Configuration Given I have a sample configuration And I have a sample reading group And I have a sample reading within the sample reading group labeled "My Reading" - And I have a sample metric configuration within the given mezuro configuration - And I have a sample range within the sample metric configuration + And I have a sample tree metric configuration within the given mezuro configuration + And I have a sample range within the sample tree metric configuration When I am at the Sample Configuration page And I click the Show link Then I should be at metric configuration sample page @@ -20,8 +20,8 @@ Feature: Show Metric Configuration Given I have a sample configuration And I have a sample reading group And I have a sample reading within the sample reading group labeled "My Reading" - And I have a sample metric configuration within the given mezuro configuration - And I have a sample range within the sample metric configuration + And I have a sample tree metric configuration within the given mezuro configuration + And I have a sample range within the sample tree metric configuration And I am at the sample metric configuration page When I click the "comment-icon" icon Then I should see "Comment" -- libgit2 0.21.2