Commit 9c27ac162961ab6784bef6ccb64342e1730cb46b

Authored by Diego Camarinha
Committed by Rafael Manzo
1 parent 075a8398

More acceptance tests for creation feature of Metric Configuration.

Signed off by: Daniel Alves <danpaulalves@gmail.com>
app/views/metric_configurations/_form.html.erb
... ... @@ -29,6 +29,7 @@
29 29  
30 30 <% if @metric_configuration.persisted? %>
31 31 <%= hidden_field_tag(:reading_group_id, @metric_configuration.reading_group_id) %>
  32 + <%= hidden_field_tag(:kalibro_configuration_id, @metric_configuration.kalibro_configuration_id) %>
32 33 <% else %>
33 34 <div class="form-row">
34 35 <div class="field-container">
... ... @@ -41,6 +42,7 @@
41 42 </p>
42 43 </div>
43 44 </div>
  45 + <%= f.hidden_field(:kalibro_configuration_id, value: @kalibro_configuration_id) %>
44 46 <% end %>
45 47  
46 48 </div>
... ...
features/metric_configuration/create.feature
... ... @@ -38,3 +38,20 @@ Feature: Metric Configuration Creation
38 38 And I click the Total Lines of Code link
39 39 When I click the Back link
40 40 Then I should be at the choose metric page
  41 +
  42 + @kalibro_configuration_restart @javascript
  43 + Scenario: compound metric configuration creation with same code
  44 + Given I am a regular user
  45 + And I am signed in
  46 + And I own a sample configuration
  47 + And I have a reading group named "Scholar"
  48 + And I have a metric configuration with code "total_abstract_classes" within the given mezuro configuration
  49 + And I am at the Sample Configuration page
  50 + And I click the Add Metric link
  51 + And I click the Total Abstract Classes link
  52 + And I take a picture of the page
  53 + And I fill the Weight field with "2"
  54 + And I set the select field "Aggregation Form" as "Average"
  55 + And I set the select field "Reading Group" as "Scholar"
  56 + When I press the Save button
  57 + Then I should see "Code must be unique within a kalibro configuration"
... ...
features/step_definitions/metric_configuration_steps.rb
1 1 Given(/^I have a sample metric configuration within the given mezuro configuration$/) do
2   - @metric_configuration = FactoryGirl.create(:metric_configuration,
  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 another metric configuration with code "(.*?)" within the given mezuro configuration$/) do |code|
7   - @another_metric_configuration = FactoryGirl.create(:metric_configuration,
8   - {kalibro_configuration_id: @kalibro_configuration.id, reading_group_id: @reading_group.id, code: code} )
  6 +Given(/^I have a metric configuration with code "(.*?)" within the given mezuro configuration$/) do |code|
  7 + @metric_configuration = FactoryGirl.create(:metric_configuration_with_id,
  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 11 When(/^I visit the sample metric configuration edit page$/) do
... ...