Commit f92dd1dc6812289798ff0040737e6a8eb9c2f0ab

Authored by Fellipe Souto Sampaio
Committed by Guilherme Rojas
1 parent 80757276

Refactored project show

Now the not signed user see a warning message to sign in before create a project

Signed-off By: Guilherme Rojas V. de Lima <guilhermehrojas@gmail.com>
app/views/projects/index.html.erb
... ... @@ -2,6 +2,15 @@
2 2 <h1>Projects</h1>
3 3 </div>
4 4  
5   -<p><% if user_signed_in? %><%= link_to 'New Project', new_project_path, class: 'btn btn-primary' %><% end %></p>
  5 +<% if user_signed_in? %>
  6 + <p>
  7 + <%= link_to 'New Project', new_project_path, class: 'btn btn-primary' %>
  8 + </p>
  9 +<%else%>
  10 + <p class="alert alert-warning alert-dismissable">
  11 + <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
  12 + To create new projects you must be logged in page.
  13 + </p>
  14 +<% end %>
6 15  
7 16 -<%= render partial: 'shared/project_list', locals: {projects: @projects} %>
  17 +<%= render partial: 'shared/project_list', locals: {projects: @projects} %>
8 18 \ No newline at end of file
... ...
features/project/listing.feature
... ... @@ -3,12 +3,13 @@ Feature: Project listing
3 3 As a regular user
4 4 I should have various listings
5 5  
6   - Scenario: Listing projects
  6 + Scenario: Listing projects
7 7 Given I am at the homepage
8 8 When I click the Project link
9 9 Then I should see "Projects"
10 10 And I should see "Name"
11 11 And I should see "Description"
  12 + And I should see "To create new projects you must be logged in page."
12 13  
13 14 @kalibro_restart
14 15 Scenario: Should list the existing projects
... ... @@ -17,6 +18,7 @@ Feature: Project listing
17 18 And I have a sample project
18 19 And I am at the All Projects page
19 20 Then the sample project should be there
  21 + And I should not see "To create new projects you must be logged in page."
20 22  
21 23 @kalibro_restart
22 24 Scenario: Should show the existing project
... ...