Commit 03e491a729392f6ef5cfa59d6214a9924a0ca2bd

Authored by Fellipe Souto Sampaio
Committed by Rafael Manzo
1 parent f12fbe89

Index metric configuration feature

signed-off-by: Guilherme Rojas V. de Lima <guilhermehrojas@gmail.com>
app/views/mezuro_configurations/_metric_configurations.html.erb 0 → 100644
... ... @@ -0,0 +1,17 @@
  1 +<tr>
  2 + <td><%= metric_configuration.metric.name %></td>
  3 + <td><%= metric_configuration.code %></td>
  4 + <td><%= metric_configuration.weight %></td>
  5 + <% if mezuro_configuration_owner? @mezuro_configuration.id %>
  6 + <td>
  7 + <%= link_to 'Edit', edit_mezuro_configuration_metric_configurations_path(@mezuro_configuration.id, metric_configuration.id),
  8 + class: 'btn btn-info' %>
  9 + </td>
  10 + <td>
  11 + <%= link_to 'Destroy', mezuro_configuration_metric_configurations_path(@mezuro_configuration.id, metric_configuration.id),
  12 + method: :delete, data: { confirm: 'Are you sure that you want to destroy this metric configuration?' },
  13 + class: 'btn btn-danger' %>
  14 + </td>
  15 + </td>
  16 + <% end %>
  17 +</tr>
0 18 \ No newline at end of file
... ...
app/views/mezuro_configurations/_no_metric_configurations.html.erb 0 → 100644
... ... @@ -0,0 +1,4 @@
  1 +<tr>
  2 + <% col_number = mezuro_configuration_owner?(@mezuro_configuration.id) ? 5 : 3 %>
  3 + <td colspan="<%= col_number %>">There are no metric configurations yet!</td>
  4 +</tr>
0 5 \ No newline at end of file
... ...
features/metric_configuration/listing.feature 0 → 100644
... ... @@ -0,0 +1,37 @@
  1 +Feature: Configuration listing
  2 + In order to interact with metric configurations
  3 + As a regular user
  4 + I should see the metric configurations of a given configuration
  5 +
  6 + @kalibro_restart
  7 + Scenario: When there is no metric configurations
  8 + Given I have a sample configuration
  9 + When I am at the Sample Configuration page
  10 + Then I should see "Metric Name"
  11 + And I should see "Code"
  12 + And I should see "Weight"
  13 + And I should see "There are no metric configurations yet!"
  14 +
  15 + @kalibro_restart
  16 + Scenario: When there are metric configurations
  17 + Given I have a sample configuration
  18 + And I have a sample reading group
  19 + And I have a sample metric configuration within the given mezuro configuration
  20 + When I am at the Sample Configuration page
  21 + Then I should see the sample metric configuration content
  22 +
  23 + @kalibro_restart
  24 + Scenario: I should see the add metric link when I am the owner of the given configuration
  25 + Given I am a regular user
  26 + And I am signed in
  27 + And I own a sample configuration
  28 + When I am at the Sample Configuration page
  29 + Then I should see "Add Metric"
  30 +
  31 + @kalibro_restart
  32 + Scenario: I should not see the add metric link when I am at a given configuration page
  33 + Given I am a regular user
  34 + And I am signed in
  35 + And I have a sample configuration
  36 + When I am at the Sample Configuration page
  37 + Then I should not see Add Metric link
0 38 \ No newline at end of file
... ...
features/step_definitions/metric_configuration_steps.rb 0 → 100644
... ... @@ -0,0 +1,11 @@
  1 +Given(/^I have a sample metric configuration within the given mezuro configuration$/) do
  2 + @metric_configuration = FactoryGirl.create(:metric_configuration,
  3 + {id: nil, configuration_id: @mezuro_configuration.id, reading_group_id: @reading_group.id} )
  4 + p @metric_configuration
  5 +end
  6 +
  7 +Then(/^I should see the sample metric configuration content$/) do
  8 + page.should have_content(@metric_configuration.metric.name)
  9 + page.should have_content(@metric_configuration.code)
  10 + page.should have_content(@metric_configuration.weight)
  11 +end
0 12 \ No newline at end of file
... ...