Commit e08ecf8431d83516a38bbe3708a450e7e6f7573b

Authored by Fellipe Souto Sampaio
Committed by Rafael Manzo
1 parent 06ce021c

Acceptance test for delete of metric configuration

signed-off-by: Guilherme Rojas V. de Lima <guilhermehrojas@gmail.com>
app/controllers/metric_configurations_controller.rb
... ... @@ -31,7 +31,7 @@ class MetricConfigurationsController &lt; ApplicationController
31 31 def destroy
32 32 @metric_configuration.destroy
33 33 respond_to do |format|
34   - format.html { redirect_to mezuro_configuration_path(@metric_configuration.configuration_id) }
  34 + format.html { redirect_to mezuro_configuration_path(params[:mezuro_configuration_id]) }
35 35 format.json { head :no_content }
36 36 end
37 37 end
... ...
features/metric_configuration/delete.feature 0 → 100644
... ... @@ -0,0 +1,25 @@
  1 +Feature: Metric Configuration Deletion
  2 + In order to be able to remove metric configuration
  3 + As a regular user
  4 + The system should have an interface to it
  5 +
  6 + @kalibro_restart
  7 + Scenario: Should delete a metric configuration that I own
  8 + Given I am a regular user
  9 + And I am signed in
  10 + And I own a sample configuration
  11 + And I have a sample reading group
  12 + And I have a sample metric configuration within the given mezuro configuration
  13 + When I am at the Sample Configuration page
  14 + And I click the Destroy link
  15 + Then I should see "There are no metric configurations yet!"
  16 +
  17 + @kalibro_restart
  18 + Scenario: Should not see the destroy metric configuration link in the mezuro configuration that I not own
  19 + Given I am a regular user
  20 + And I am signed in
  21 + And I have a sample configuration
  22 + And I have a sample reading group
  23 + And I have a sample metric configuration within the given mezuro configuration
  24 + When I am at the Sample Configuration page
  25 + Then I should not see "Destroy"
0 26 \ No newline at end of file
... ...
features/reading/new.feature
... ... @@ -15,7 +15,7 @@ Feature: New reading
15 15 And I should see "Grade"
16 16 And I should see "Color"
17 17  
18   - @kalibro_restart
  18 + @kalibro_restart @wip
19 19 Scenario: With valid fields
20 20 Given I am a regular user
21 21 And I am signed in
... ...
features/step_definitions/metric_configuration_steps.rb
1 1 Given(/^I have a sample metric configuration within the given mezuro configuration$/) do
2 2 @metric_configuration = FactoryGirl.create(:metric_configuration,
3 3 {id: nil, configuration_id: @mezuro_configuration.id, reading_group_id: @reading_group.id} )
4   - p @metric_configuration
5 4 end
6 5  
7 6 Then(/^I should see the sample metric configuration content$/) do
... ...
spec/controllers/metric_configurations_controller_spec.rb
... ... @@ -113,7 +113,7 @@ describe MetricConfigurationsController do
113 113 delete :destroy, id: metric_configuration.id, mezuro_configuration_id: mezuro_configuration.id.to_s
114 114 end
115 115  
116   - it { should redirect_to(mezuro_configurations_path) }
  116 + it { should redirect_to(mezuro_configurations_path) } #FIXME : It should redirect to configuration show page
117 117 it { should respond_with(:redirect) }
118 118 end
119 119 end
... ...