Commit 62774448ccf5ea58fb92ee5541351d3512e6bcdb
Committed by
Guilherme Rojas
1 parent
2ed4b270
Exists in
colab
and in
4 other branches
Refactoring tests for project's edition to cover ownership
PS: the tests isn't covering ownership verification in Controller.
Showing
2 changed files
with
13 additions
and
3 deletions
Show diff stats
app/views/projects/index.html.erb
| @@ -15,7 +15,9 @@ | @@ -15,7 +15,9 @@ | ||
| 15 | <td><%= project.name %></td> | 15 | <td><%= project.name %></td> |
| 16 | <td><%= project.description %></td> | 16 | <td><%= project.description %></td> |
| 17 | <td><%= link_to 'Show', project_path(project.id) %></td> | 17 | <td><%= link_to 'Show', project_path(project.id) %></td> |
| 18 | - <td><%= link_to 'Edit', edit_project_path(project.id) %></td> | 18 | + <% if project_owner? project.id %> |
| 19 | + <td><%= link_to 'Edit', edit_project_path(project.id) %></td> | ||
| 20 | + <% end %> | ||
| 19 | </tr> | 21 | </tr> |
| 20 | <% end %> | 22 | <% end %> |
| 21 | </tbody> | 23 | </tbody> |
features/project/edition.feature
| @@ -4,13 +4,21 @@ Feature: Project | @@ -4,13 +4,21 @@ Feature: Project | ||
| 4 | I should be able to edit my projects | 4 | I should be able to edit my projects |
| 5 | 5 | ||
| 6 | @kalibro_restart | 6 | @kalibro_restart |
| 7 | - Scenario: Going to the edit page | 7 | + Scenario: Should go to the edit page from a project that I own |
| 8 | Given I am a regular user | 8 | Given I am a regular user |
| 9 | And I am signed in | 9 | And I am signed in |
| 10 | - And I have a sample project | 10 | + And I own a sample project |
| 11 | And I am at the All Projects page | 11 | And I am at the All Projects page |
| 12 | When I click the Edit link | 12 | When I click the Edit link |
| 13 | Then I should be in the Edit Project page | 13 | Then I should be in the Edit Project page |
| 14 | + | ||
| 15 | + @kalibro_restart | ||
| 16 | + Scenario: Should not show edit links from projects that doesn't belongs to me | ||
| 17 | + Given I am a regular user | ||
| 18 | + And I am signed in | ||
| 19 | + And I have a sample project | ||
| 20 | + And I am at the All Projects page | ||
| 21 | + Then I should not see Edit | ||
| 14 | 22 | ||
| 15 | @kalibro_restart | 23 | @kalibro_restart |
| 16 | Scenario: Filling up the form | 24 | Scenario: Filling up the form |