From 62774448ccf5ea58fb92ee5541351d3512e6bcdb Mon Sep 17 00:00:00 2001 From: Guilherme Rojas V. de Lima Date: Tue, 3 Sep 2013 15:14:59 -0300 Subject: [PATCH] Refactoring tests for project's edition to cover ownership --- app/views/projects/index.html.erb | 4 +++- features/project/edition.feature | 12 ++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb index 65debd9..541f27d 100644 --- a/app/views/projects/index.html.erb +++ b/app/views/projects/index.html.erb @@ -15,7 +15,9 @@ <%= project.name %> <%= project.description %> <%= link_to 'Show', project_path(project.id) %> - <%= link_to 'Edit', edit_project_path(project.id) %> + <% if project_owner? project.id %> + <%= link_to 'Edit', edit_project_path(project.id) %> + <% end %> <% end %> diff --git a/features/project/edition.feature b/features/project/edition.feature index ace2a3a..6f6c796 100644 --- a/features/project/edition.feature +++ b/features/project/edition.feature @@ -4,13 +4,21 @@ Feature: Project I should be able to edit my projects @kalibro_restart - Scenario: Going to the edit page + Scenario: Should go to the edit page from a project that I own Given I am a regular user And I am signed in - And I have a sample project + And I own a sample project And I am at the All Projects page When I click the Edit link Then I should be in the Edit Project page + + @kalibro_restart + Scenario: Should not show edit links from projects that doesn't belongs to me + Given I am a regular user + And I am signed in + And I have a sample project + And I am at the All Projects page + Then I should not see Edit @kalibro_restart Scenario: Filling up the form -- libgit2 0.21.2