Commit 7a1820e6873416b33cdca27a8af9632952f45b68

Authored by Heitor
1 parent db1f4354

List hotspot metric configurations

 * Also renamed some step definitions to explicitly use tree metric
 configurations or hotspot metric configurations
 * Also added translations for the cases when there are no metric
 configurations of each type
 * Showing name and code on the table for hotspot metric configurations
 * When adding a hotspot metric configuration, the weight will be

Signed off by: Diego Araújo <diegoamc90@gmail.com>
app/views/kalibro_configurations/_metric_configurations.html.erb
1 1 <tr>
2 2 <td><%= metric_configuration.metric.name %></td>
  3 + <td><%= metric_configuration.metric.code %></td>
3 4 <% unless metric_configuration.metric.is_a? KalibroClient::Entities::Miscellaneous::HotspotMetric %>
4   - <td><%= metric_configuration.metric.code %></td>
5 5 <td><%= metric_configuration.weight %></td>
6 6 <% end %>
7 7 <td>
... ...
app/views/kalibro_configurations/_no_metric_configurations.html.erb
1 1 <tr>
2 2 <% col_number = kalibro_configuration_owner?(@kalibro_configuration.id) ? 5 : 3 %>
3   - <td colspan="<%= col_number %>"><%= t('no_metric_configurations') %></td>
4   -</tr>
5 3 \ No newline at end of file
  4 + <td colspan="<%= col_number %>">
  5 + <%= t(message) %>
  6 + </td>
  7 +</tr>
... ...
app/views/kalibro_configurations/show.html.erb
... ... @@ -25,7 +25,7 @@
25 25 </thead>
26 26 <tbody>
27 27 <% if Rails.cache.read("#{@kalibro_configuration.id}_tree_metric_configurations").empty? %>
28   - <%= render partial: 'no_metric_configurations' %>
  28 + <%= render partial: 'no_metric_configurations', locals: { message: 'no_tree_metric_configurations' } %>
29 29 <% else %>
30 30 <%= render partial: 'metric_configurations', collection: Rails.cache.read("#{@kalibro_configuration.id}_tree_metric_configurations"), as: :metric_configuration %>
31 31 <% end %>
... ... @@ -42,12 +42,13 @@
42 42 <thead>
43 43 <tr>
44 44 <th><%= t('metric') %></th>
45   - <th colspan="1"></th>
  45 + <th><%= t('code') %></th>
  46 + <th colspan="2"></th>
46 47 </tr>
47 48 </thead>
48 49 <tbody>
49 50 <% if Rails.cache.read("#{@kalibro_configuration.id}_hotspot_metric_configurations").empty? %>
50   - <%= render partial: 'no_metric_configurations' %>
  51 + <%= render partial: 'no_metric_configurations', locals: { message: 'no_hotspot_metric_configurations' } %>
51 52 <% else %>
52 53 <%= render partial: 'metric_configurations', collection: Rails.cache.read("#{@kalibro_configuration.id}_hotspot_metric_configurations"), as: :metric_configuration %>
53 54 <% end %>
... ...
config/locales/views/metric_configurations/en.yml
... ... @@ -23,7 +23,8 @@ en:
23 23 metric_configurations_base_tool_name: "Base Tool Name:"
24 24 metric_configurations_aggregation: "Aggregation Form"
25 25 metric_configurations_reading_group: "Reading Group Name"
26   - no_metric_configurations: "There are no Metric Configurations yet!"
  26 + no_tree_metric_configurations: "There are no Tree Metric Configurations yet!"
  27 + no_hotspot_metric_configurations: "There are no Hotspot Metric Configurations yet!"
27 28 destroy_metric_configuration: "Destroy Metric Configuration"
28 29 want_destroy_metric_configuration: "Are you sure that you want to destroy this Metric Configuration?"
29 30 metric_base_tool_name: "Base Tool Name"
... ...
config/locales/views/metric_configurations/pt.yml
... ... @@ -27,7 +27,8 @@ pt:
27 27 metric_configurations_base_tool_name: "Nome da ferramenta base:"
28 28 metric_configurations_aggregation: "Forma de Agregação"
29 29 metric_configurations_reading_group: "Nome do grupo"
30   - no_metric_configurations: "Não há configurações de métricas ainda!"
  30 + no_tree_metric_configurations: "Não há configurações de métricas escalares ainda!"
  31 + no_hotspot_metric_configurations: "Não há configurações de métricas de Hotspot ainda!"
31 32 destroy_metric_configuration: "Destruir Configuração de Métrica"
32 33 want_destroy_metric_configuration: "Tem certeza que você quer destruir esta Configuração de Métrica?"
33 34 metric_base_tool_name: "Coletor"
... ...
features/compound_metric_configuration/create.feature
... ... @@ -9,7 +9,7 @@ Feature: Compound Metric Configuration Creation
9 9 And I am signed in
10 10 And I own a sample configuration
11 11 And I have a reading group named "Scholar"
12   - And I have a sample metric configuration within the given mezuro configuration
  12 + And I have a sample tree metric configuration within the given mezuro configuration
13 13 And I am at the Sample Configuration page
14 14 And I click the Add Metric link
15 15 And I click the Compound Metric link
... ...
features/compound_metric_configuration/edition.feature
... ... @@ -9,7 +9,7 @@ Feature: Compound Metric Configuration edition
9 9 And I am signed in
10 10 And I have a sample configuration
11 11 And I have a sample reading group
12   - And I have a sample metric configuration within the given mezuro configuration
  12 + And I have a sample tree metric configuration within the given mezuro configuration
13 13 And I have a sample compound metric configuration within the given mezuro configuration
14 14 When I am at the Sample Configuration page
15 15 Then I should not find "Edit" within "table#tree_metric_configurations"
... ... @@ -20,7 +20,7 @@ Feature: Compound Metric Configuration edition
20 20 And I am signed in
21 21 And I own a sample configuration
22 22 And I have a sample reading group
23   - And I have a sample metric configuration within the given mezuro configuration
  23 + And I have a sample tree metric configuration within the given mezuro configuration
24 24 And I have a sample compound metric configuration within the given mezuro configuration
25 25 And I am at the Sample Configuration page
26 26 When I click the edit link of the Coumpound Metric
... ... @@ -36,7 +36,7 @@ Feature: Compound Metric Configuration edition
36 36 And I am signed in
37 37 And I own a sample configuration
38 38 And I have a sample reading group
39   - And I have a sample metric configuration within the given mezuro configuration
  39 + And I have a sample tree metric configuration within the given mezuro configuration
40 40 And I have a sample compound metric configuration within the given mezuro configuration
41 41 When I visit the sample compound metric configuration edit page
42 42 And I fill the Name field with " "
... ... @@ -57,7 +57,7 @@ Feature: Compound Metric Configuration edition
57 57 And I am signed in
58 58 And I own a sample configuration
59 59 And I have a sample reading group
60   - And I have a sample metric configuration within the given mezuro configuration
  60 + And I have a sample tree metric configuration within the given mezuro configuration
61 61 And I have a sample compound metric configuration within the given mezuro configuration
62 62 And I have another compound metric configuration with code "Another_Code" within the given mezuro configuration
63 63 When I visit the sample compound metric configuration edit page
... ...
features/hotspot_metric_configuration/listing.feature 0 → 100644
... ... @@ -0,0 +1,24 @@
  1 +Feature: Hotspot Configuration listing
  2 + In order to interact with hotspot metric configurations
  3 + As a regular user
  4 + I should see the hotspot metric configurations of a given kalibro configuration
  5 +
  6 + @kalibro_configuration_restart @javascript @wip
  7 + Scenario: When there are hotspot metric configurations and no tree metric configurations
  8 + Given I have a sample configuration
  9 + And I have a sample hotspot metric configuration within the given mezuro configuration
  10 + When I am at the Sample Configuration page
  11 + Then I should see the sample hotspot metric configuration content
  12 + And I take a picture of the page
  13 + And I should see "There are no Tree Metric Configurations yet!"
  14 +
  15 +
  16 + @kalibro_configuration_restart @wip
  17 + Scenario: When there are hotspot metric configurations and tree metric configurations
  18 + Given I have a sample configuration
  19 + And I have a sample hotspot metric configuration within the given mezuro configuration
  20 + And I have a sample reading group
  21 + And I have a sample tree metric configuration within the given mezuro configuration
  22 + When I am at the Sample Configuration page
  23 + Then I should see the sample hotspot metric configuration content
  24 + And I should not see "There are no Tree Metric Configurations yet!"
... ...
features/kalibro_range/create.feature
... ... @@ -9,7 +9,7 @@ Feature: Create Kalibro Range
9 9 And I am signed in
10 10 And I own a sample configuration
11 11 And I own a sample reading group
12   - And I have a sample metric configuration within the given mezuro configuration
  12 + And I have a sample tree metric configuration within the given mezuro configuration
13 13 And I have a sample reading within the sample reading group labeled "My Reading"
14 14 And I am at the sample metric configuration page
15 15 When I click the Add Range link
... ... @@ -25,7 +25,7 @@ Feature: Create Kalibro Range
25 25 And I am signed in
26 26 And I own a sample configuration
27 27 And I have a reading group named "Scholar"
28   - And I have a sample metric configuration within the given mezuro configuration
  28 + And I have a sample tree metric configuration within the given mezuro configuration
29 29 And I am at the sample metric configuration page
30 30 When I click the Add Range link
31 31 Then I should be at the New Range page
... ... @@ -41,7 +41,7 @@ Feature: Create Kalibro Range
41 41 And I am signed in
42 42 And I own a sample configuration
43 43 And I own a sample reading group
44   - And I have a sample metric configuration within the given mezuro configuration
  44 + And I have a sample tree metric configuration within the given mezuro configuration
45 45 And I am at the sample metric configuration page
46 46 When I click the Add Range link
47 47 Then I should be at the New Range page
... ... @@ -61,7 +61,7 @@ Feature: Create Kalibro Range
61 61 And I am signed in
62 62 And I own a sample configuration
63 63 And I own a sample reading group
64   - And I have a sample metric configuration within the given mezuro configuration
  64 + And I have a sample tree metric configuration within the given mezuro configuration
65 65 And I have a sample reading within the sample reading group labeled "My Reading"
66 66 And I am at the New Range page
67 67 And I fill the Beginning field with "42"
... ... @@ -77,7 +77,7 @@ Feature: Create Kalibro Range
77 77 And I am signed in
78 78 And I own a sample configuration
79 79 And I own a sample reading group
80   - And I have a sample metric configuration within the given mezuro configuration
  80 + And I have a sample tree metric configuration within the given mezuro configuration
81 81 And I have a sample reading within the sample reading group labeled "My Reading"
82 82 And I am at the New Range page
83 83 And I fill the Beginning field with "666"
... ... @@ -95,7 +95,7 @@ Feature: Create Kalibro Range
95 95 And I am signed in
96 96 And I own a sample configuration
97 97 And I own a sample reading group
98   - And I have a sample metric configuration within the given mezuro configuration
  98 + And I have a sample tree metric configuration within the given mezuro configuration
99 99 And I have a sample reading within the sample reading group labeled "My Reading"
100 100 And I am at the New Range page
101 101 And I fill the Beginning field with "z"
... ... @@ -113,7 +113,7 @@ Feature: Create Kalibro Range
113 113 And I am signed in
114 114 And I own a sample configuration
115 115 And I own a sample reading group
116   - And I have a sample metric configuration within the given mezuro configuration
  116 + And I have a sample tree metric configuration within the given mezuro configuration
117 117 And I have a sample reading within the sample reading group labeled "My Reading"
118 118 And I am at the New Range page
119 119 And I fill the Beginning field with "-1"
... ... @@ -131,9 +131,9 @@ Feature: Create Kalibro Range
131 131 And I am signed in
132 132 And I own a sample configuration
133 133 And I own a sample reading group
134   - And I have a sample metric configuration within the given mezuro configuration
  134 + And I have a sample tree metric configuration within the given mezuro configuration
135 135 And I have a sample reading within the sample reading group labeled "My Reading"
136   - And I have a sample range within the sample metric configuration with beginning "2"
  136 + And I have a sample range within the sample tree metric configuration with beginning "2"
137 137 And I am at the New Range page
138 138 And I fill the Beginning field with "2"
139 139 And I fill the End field with "666"
... ... @@ -151,7 +151,7 @@ Feature: Create Kalibro Range
151 151 And I am signed in
152 152 And I own a sample configuration
153 153 And I own a sample reading group
154   - And I have a sample metric configuration within the given mezuro configuration
  154 + And I have a sample tree metric configuration within the given mezuro configuration
155 155 And I have a sample reading within the sample reading group labeled "My Reading"
156 156 And I am at the New Range page
157 157 And I click the -∞ link
... ... @@ -169,7 +169,7 @@ Feature: Create Kalibro Range
169 169 And I am signed in
170 170 And I own a sample configuration
171 171 And I own a sample reading group
172   - And I have a sample metric configuration within the given mezuro configuration
  172 + And I have a sample tree metric configuration within the given mezuro configuration
173 173 And I have a sample reading within the sample reading group labeled "My Reading"
174 174 And I am at the New Range page
175 175 And I fill the Beginning field with "2"
... ... @@ -193,7 +193,7 @@ Feature: Create Kalibro Range
193 193 And I am signed in
194 194 And I own a sample configuration
195 195 And I own a sample reading group
196   - And I have a sample metric configuration within the given mezuro configuration
  196 + And I have a sample tree metric configuration within the given mezuro configuration
197 197 And I have a sample compound metric configuration within the given mezuro configuration
198 198 And I have a sample reading within the sample reading group labeled "My Reading"
199 199 And I am at the New Range page for the compound metric configuration
... ...
features/kalibro_range/deletion.feature
... ... @@ -9,9 +9,9 @@ Feature: Kalibro Range Deletion
9 9 And I am signed in
10 10 And I own a sample configuration
11 11 And I have a sample reading group
12   - And I have a sample metric configuration within the given mezuro configuration
  12 + And I have a sample tree metric configuration within the given mezuro configuration
13 13 And I have a sample reading within the sample reading group labeled "My Reading"
14   - And I have a sample range within the sample metric configuration
  14 + And I have a sample range within the sample tree metric configuration
15 15 And I am at the sample metric configuration page
16 16 When I click the Destroy link
17 17 Then I should be at metric configuration sample page
... ... @@ -37,8 +37,8 @@ Feature: Kalibro Range Deletion
37 37 And I am signed in
38 38 And I have a sample configuration
39 39 And I have a sample reading group
40   - And I have a sample metric configuration within the given mezuro configuration
  40 + And I have a sample tree metric configuration within the given mezuro configuration
41 41 And I have a sample reading within the sample reading group labeled "My Reading"
42   - And I have a sample range within the sample metric configuration
  42 + And I have a sample range within the sample tree metric configuration
43 43 When I am at the sample metric configuration page
44 44 Then I should not see "Destroy"
... ...
features/kalibro_range/edit.feature
... ... @@ -9,9 +9,9 @@ Feature: Kalibro Range Edit
9 9 And I am signed in
10 10 And I own a sample configuration
11 11 And I own a sample reading group
12   - And I have a sample metric configuration within the given mezuro configuration
  12 + And I have a sample tree metric configuration within the given mezuro configuration
13 13 And I have a sample reading within the sample reading group labeled "My Reading"
14   - And I have a sample range within the sample metric configuration with beginning "1.1"
  14 + And I have a sample range within the sample tree metric configuration with beginning "1.1"
15 15 And I am at the Edit Kalibro Range page
16 16 And the select field "Reading" is set as "My Reading"
17 17 And the field "Beginning" should be filled with "1.1"
... ... @@ -45,9 +45,9 @@ Feature: Kalibro Range Edit
45 45 And I am signed in
46 46 And I own a sample configuration
47 47 And I own a sample reading group
48   - And I have a sample metric configuration within the given mezuro configuration
  48 + And I have a sample tree metric configuration within the given mezuro configuration
49 49 And I have a sample reading within the sample reading group labeled "My Reading"
50   - And I have a sample range within the sample metric configuration with beginning "1"
  50 + And I have a sample range within the sample tree metric configuration with beginning "1"
51 51 And I am at the Edit Kalibro Range page
52 52 When I fill the Beginning field with " "
53 53 And I press the Save button
... ...
features/step_definitions/kalibro_range_steps.rb
1   -Given(/^I have a sample range within the sample metric configuration with beginning "(.*?)"$/) do |beginning|
  1 +Given(/^I have a sample range within the sample tree metric configuration with beginning "(.*?)"$/) do |beginning|
2 2 @kalibro_range = FactoryGirl.create(:kalibro_range, {beginning: beginning, metric_configuration_id: @metric_configuration.id,
3 3 reading_id: @reading.id})
4 4 end
... ... @@ -20,7 +20,7 @@ Given(/^the select field &quot;(.*?)&quot; is set as &quot;(.*?)&quot;$/) do |field, text|
20 20 select text, from: field
21 21 end
22 22  
23   -Given(/^I have a sample range within the sample metric configuration$/) do
  23 +Given(/^I have a sample range within the sample tree metric configuration$/) do
24 24 @kalibro_range = FactoryGirl.create(:kalibro_range, {metric_configuration_id: @metric_configuration.id,
25 25 reading_id: @reading.id})
26 26 end
... ...
features/step_definitions/metric_configuration_steps.rb
1   -Given(/^I have a sample metric configuration within the given mezuro configuration$/) do
  1 +Given(/^I have a sample tree metric configuration within the given mezuro configuration$/) do
2 2 @metric_configuration = FactoryGirl.create(:metric_configuration_with_id,
3 3 {kalibro_configuration_id: @kalibro_configuration.id, reading_group_id: @reading_group.id} )
4 4 end
5 5  
  6 +Given(/^I have a sample hotspot metric configuration within the given mezuro configuration$/) do
  7 + @metric_configuration = FactoryGirl.create(:hotspot_metric_configuration,
  8 + kalibro_configuration_id: @kalibro_configuration.id)
  9 +end
  10 +
  11 +
6 12 Given(/^I have a metric configuration with code "(.*?)" within the given mezuro configuration$/) do |code|
7 13 @metric_configuration = FactoryGirl.create(:metric_configuration_with_id,
8 14 {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
51 57 expect(page).to have_content("Ranges")
52 58 end
53 59  
54   -Then(/^I should see the sample metric configuration content$/) do
  60 +Then(/^I should see the sample tree metric configuration content$/) do
55 61 expect(page).to have_content(@metric_configuration.metric.name)
56 62 expect(page).to have_content(@metric_configuration.metric.code)
57 63 expect(page).to have_content(@metric_configuration.weight)
58 64 end
59 65  
  66 +Then(/^I should see the sample hotspot metric configuration content$/) do
  67 + expect(page).to have_content(@metric_configuration.metric.name)
  68 + expect(page).to have_content(@metric_configuration.metric.code)
  69 +end
  70 +
60 71 Then(/^I should be at metric configuration sample page$/) do
61 72 expect(page).to have_content(@metric_configuration.metric.name)
62 73 expect(page).to have_content("Ranges")
... ...
features/tree_metric_configuration/delete.feature
... ... @@ -9,10 +9,10 @@ Feature: Metric Configuration Deletion
9 9 And I am signed in
10 10 And I own a sample configuration
11 11 And I have a sample reading group
12   - And I have a sample metric configuration within the given mezuro configuration
  12 + And I have a sample tree metric configuration within the given mezuro configuration
13 13 When I am at the Sample Configuration page
14 14 And I click destroy Metric Configuration
15   - Then I should see "There are no Metric Configurations yet!"
  15 + Then I should see "There are no Tree Metric Configurations yet!"
16 16  
17 17 @kalibro_configuration_restart
18 18 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
20 20 And I am signed in
21 21 And I have a sample configuration
22 22 And I have a sample reading group
23   - And I have a sample metric configuration within the given mezuro configuration
  23 + And I have a sample tree metric configuration within the given mezuro configuration
24 24 When I am at the Sample Configuration page
25 25 Then I should not see "Destroy"
... ...
features/tree_metric_configuration/edition.feature
... ... @@ -9,9 +9,9 @@ Feature: Metric Configuration edition
9 9 And I am signed in
10 10 And I have a sample configuration
11 11 And I have a sample reading group
12   - And I have a sample metric configuration within the given mezuro configuration
  12 + And I have a sample tree metric configuration within the given mezuro configuration
13 13 When I am at the Sample Configuration page
14   - Then I should not see Edit within table
  14 + Then I should not see Edit within table#tree_metric_configurations
15 15  
16 16 @kalibro_configuration_restart
17 17 Scenario: editing a metric configuration successfully
... ... @@ -19,7 +19,7 @@ Feature: Metric Configuration edition
19 19 And I am signed in
20 20 And I own a sample configuration
21 21 And I have a sample reading group
22   - And I have a sample metric configuration within the given mezuro configuration
  22 + And I have a sample tree metric configuration within the given mezuro configuration
23 23 And I am at the Sample Configuration page
24 24 When I click the Edit link
25 25 And I fill the Weight field with "3.0"
... ... @@ -32,7 +32,7 @@ Feature: Metric Configuration edition
32 32 And I am signed in
33 33 And I own a sample configuration
34 34 And I have a sample reading group
35   - And I have a sample metric configuration within the given mezuro configuration
  35 + And I have a sample tree metric configuration within the given mezuro configuration
36 36 When I visit the sample metric configuration edit page
37 37 And I fill the Weight field with " "
38 38 And I press the Save button
... ... @@ -44,7 +44,7 @@ Feature: Metric Configuration edition
44 44 And I am signed in
45 45 And I own a sample configuration
46 46 And I have a sample reading group
47   - And I have a sample metric configuration within the given mezuro configuration
  47 + And I have a sample tree metric configuration within the given mezuro configuration
48 48 When I visit the sample metric configuration edit page
49 49 And I fill the Weight field with "0"
50 50 And I set the select field "Aggregation Form" as "Median"
... ...
features/tree_metric_configuration/listing.feature
1   -Feature: Configuration listing
  1 +Feature: Metric Configuration listing
2 2 In order to interact with metric configurations
3 3 As a regular user
4 4 I should see the metric configurations of a given configuration
5 5  
6 6 @kalibro_configuration_restart
7   - Scenario: When there are no metric configurations
  7 + Scenario: When there are no tree metric configurations
8 8 Given I have a sample configuration
9 9 When I am at the Sample Configuration page
10 10 Then I should see "Metric"
11 11 And I should see "Code"
12 12 And I should see "Weight"
13   - And I should see "There are no Metric Configurations yet!"
  13 + And I should see "There are no Tree Metric Configurations yet!"
14 14  
15   - @kalibro_configuration_restart
16   - Scenario: When there are metric configurations
  15 + @kalibro_configuration_restart @wip
  16 + Scenario: When there are tree metric configurations and no hotspot metric configurations
17 17 Given I have a sample configuration
18 18 And I have a sample reading group
19   - And I have a sample metric configuration within the given mezuro configuration
  19 + And I have a sample tree metric configuration within the given mezuro configuration
20 20 When I am at the Sample Configuration page
21   - Then I should see the sample metric configuration content
  21 + Then I should see the sample tree metric configuration content
  22 + And I should see "There are no Hotspot Metric Configurations yet!"
22 23  
23 24 @kalibro_configuration_restart
24 25 Scenario: I should see the add metric link when I am the owner of the given configuration
... ...
features/tree_metric_configuration/show.feature
... ... @@ -8,8 +8,8 @@ Feature: Show Metric Configuration
8 8 Given I have a sample configuration
9 9 And I have a sample reading group
10 10 And I have a sample reading within the sample reading group labeled "My Reading"
11   - And I have a sample metric configuration within the given mezuro configuration
12   - And I have a sample range within the sample metric configuration
  11 + And I have a sample tree metric configuration within the given mezuro configuration
  12 + And I have a sample range within the sample tree metric configuration
13 13 When I am at the Sample Configuration page
14 14 And I click the Show link
15 15 Then I should be at metric configuration sample page
... ... @@ -20,8 +20,8 @@ Feature: Show Metric Configuration
20 20 Given I have a sample configuration
21 21 And I have a sample reading group
22 22 And I have a sample reading within the sample reading group labeled "My Reading"
23   - And I have a sample metric configuration within the given mezuro configuration
24   - And I have a sample range within the sample metric configuration
  23 + And I have a sample tree metric configuration within the given mezuro configuration
  24 + And I have a sample range within the sample tree metric configuration
25 25 And I am at the sample metric configuration page
26 26 When I click the "comment-icon" icon
27 27 Then I should see "Comment"
... ...