From 80951241d5d06c4aa58322b0df60f57d71c2b560 Mon Sep 17 00:00:00 2001 From: Beatriz Rezener Date: Wed, 12 Nov 2014 17:23:03 -0200 Subject: [PATCH] Acceptance tests for ReadingGroup destroying --- features/mezuro_configuration/deletion.feature | 2 +- features/reading_group/delete.feature | 28 ++++++++++++++++++++++++++++ features/step_definitions/reading_group_steps.rb | 6 +++++- 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 features/reading_group/delete.feature diff --git a/features/mezuro_configuration/deletion.feature b/features/mezuro_configuration/deletion.feature index b2529a4..b04ab0b 100644 --- a/features/mezuro_configuration/deletion.feature +++ b/features/mezuro_configuration/deletion.feature @@ -4,7 +4,7 @@ Feature: Configuration Deletion The system should have an interface to it @kalibro_restart - Scenario: Should not delete a configuration without user authetication + Scenario: Should not delete a configuration without user authentication Given I have a sample configuration When I am at the Sample Configuration page Then I should not see Destroy diff --git a/features/reading_group/delete.feature b/features/reading_group/delete.feature new file mode 100644 index 0000000..6b2cfcf --- /dev/null +++ b/features/reading_group/delete.feature @@ -0,0 +1,28 @@ +Feature: Reading Group Deletion + In order to be able to remove a reading group + As a regular user + The system should have an interface to it + + @kalibro_restart + Scenario: Should not delete a reading group without user authentication + Given I have a sample reading group + When I visit the Sample Reading Group page + Then I should not see Destroy + + @kalibro_restart + Scenario: Should not delete a reading group that doesn't belongs to user + Given I am a regular user + And I am signed in + And I have a sample reading group + When I visit the Sample Reading Group page + Then I should not see Destroy + + @kalibro_restart + Scenario: Should delete a reading group that I own + Given I am a regular user + And I am signed in + And I own a sample reading group + And I visit the Sample Reading Group page + When I click the Destroy Reading Group link + Then I should see "New Reading Group" + And the Sample Reading Group should not be there diff --git a/features/step_definitions/reading_group_steps.rb b/features/step_definitions/reading_group_steps.rb index b14d69e..52f1146 100644 --- a/features/step_definitions/reading_group_steps.rb +++ b/features/step_definitions/reading_group_steps.rb @@ -62,4 +62,8 @@ end Then(/^I should be in the Edit Reading Group page$/) do visit edit_reading_group_path(@reading_group.id) -end \ No newline at end of file +end + +Then(/^the Sample Reading Group should not be there$/) do + expect { ReadingGroup.find(@reading_group.id) }.to raise_error +end -- libgit2 0.21.2