diff --git a/app/views/mezuro_configurations/show.html.erb b/app/views/mezuro_configurations/show.html.erb index 946a646..b574441 100644 --- a/app/views/mezuro_configurations/show.html.erb +++ b/app/views/mezuro_configurations/show.html.erb @@ -11,4 +11,7 @@
<%= link_to 'Back', mezuro_configurations_path, class: 'btn btn-default' %> + <% if configuration_owner? @configuration.id %> + <%= link_to 'Destroy configuration', mezuro_configuration_path(@configuration.id), method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger' %> + <% end %>
diff --git a/features/mezuro_configuration/deletion.feature b/features/mezuro_configuration/deletion.feature index 9bc2b0e..94ca862 100644 --- a/features/mezuro_configuration/deletion.feature +++ b/features/mezuro_configuration/deletion.feature @@ -17,7 +17,7 @@ Feature: Configuration Deletion When I am at the Sample Configuration page Then I should not see Destroy - @kalibro_restart @wip + @kalibro_restart Scenario: Should delete a configuration that I own Given I am a regular user And I am signed in diff --git a/features/mezuro_configuration/edition.feature b/features/mezuro_configuration/edition.feature index c8bb950..f1a3463 100644 --- a/features/mezuro_configuration/edition.feature +++ b/features/mezuro_configuration/edition.feature @@ -3,7 +3,7 @@ Feature: Configuration As a regular user I should be able to edit my configurations - @kalibro_restarts @wip + @kalibro_restart Scenario: Should go to the edit page from a configuration that I own Given I am a regular user And I am signed in @@ -20,7 +20,7 @@ Feature: Configuration And I am at the All Configurations page Then I should not see "Edit" within "table tr td" - @kalibro_restart @wip + @kalibro_restart Scenario: Should not render the edit page if the configuration doesn't belongs to the current user Given I am a regular user And I am signed in @@ -29,7 +29,7 @@ Feature: Configuration When I visit the sample configuration edit page Then I should see "You're not allowed to do this operation" - @kalibro_restart @wip + @kalibro_restart Scenario: Filling up the form Given I am a regular user And I am signed in @@ -39,7 +39,7 @@ Feature: Configuration Then The field "mezuro_configuration[name]" should be filled with the sample configuration "name" And The field "mezuro_configuration[description]" should be filled with the sample configuration "description" - @kalibro_restart @wip + @kalibro_restart Scenario: With valid attributes Given I am a regular user And I am signed in @@ -51,7 +51,7 @@ Feature: Configuration Then I should see "Kalibro" And I should see "Web Service to collect metrics" - @kalibro_restart @wip + @kalibro_restart Scenario: With configuration name already taken Given I am a regular user And I am signed in @@ -62,7 +62,7 @@ Feature: Configuration When I press the Save button Then I should see "There's already" - @kalibro_restart @wip + @kalibro_restart Scenario: Editing just the description Given I am a regular user And I am signed in @@ -72,7 +72,7 @@ Feature: Configuration When I press the Save button And I should see "Web Service to collect metrics" - @kalibro_restart @wip + @kalibro_restart Scenario: With blank configuration name Given I am a regular user And I am signed in diff --git a/features/step_definitions/configuration_steps.rb b/features/step_definitions/configuration_steps.rb index be1ee8d..dc56f8e 100644 --- a/features/step_definitions/configuration_steps.rb +++ b/features/step_definitions/configuration_steps.rb @@ -15,8 +15,8 @@ Given(/^I have a sample configuration$/) do end Given(/^I own a sample configuration$/) do - @mezuro_configuration = FactoryGirl.build(:mezuro_configuration, {id: nil}) - FactoryGirl.create(:mezuro_configuration_ownership, {user_id: @user.id, mezuro_configuration_id: @mezuro_configuration.id}) + @mezuro_configuration = FactoryGirl.create(:mezuro_configuration, {id: nil}) + FactoryGirl.create(:mezuro_configuration_ownership, {id: nil, user_id: @user.id, mezuro_configuration_id: @mezuro_configuration.id}) end Given(/^I am at the Sample Configuration page$/) do @@ -28,12 +28,12 @@ Given(/^I am at the sample configuration edit page$/) do end Given(/^I own a configuration named "(.*?)"$/) do |name| - @mezuro_configuration = FactoryGirl.build(:mezuro_configuration, {id: nil, name: name}) - FactoryGirl.create(:mezuro_configuration_ownership, {user_id: @user.id, mezuro_configuration_id: @mezuro_configuration.id}) + @mezuro_configuration = FactoryGirl.create(:mezuro_configuration, {id: nil, name: name}) + FactoryGirl.create(:mezuro_configuration_ownership, {id: nil, user_id: @user.id, mezuro_configuration_id: @mezuro_configuration.id}) end When(/^I visit the sample configuration edit page$/) do - visit edit_mezuro_configuration(@mezuro_configuration.id) + visit edit_mezuro_configuration_path(@mezuro_configuration.id) end Then(/^I should be in the Edit Configuration page$/) do -- libgit2 0.21.2