Permalink
Browse files

Users can sign in with the default Devise forms

  • Loading branch information...
1 parent 3612364 commit 8c4f943c087c075c569a07bb9bbc600a85669c2a @mlambie committed Oct 3, 2011
Showing with 20 additions and 8 deletions.
  1. +6 −7 app/views/layouts/application.html.erb
  2. +12 −1 features/signing_in.feature
  3. +2 −0 features/step_definitions/user_steps.rb
@@ -19,13 +19,12 @@
<a class="brand" href="/">School</a>
<ul class="nav">
<li><%= link_to "Courses", courses_path %></li>
- <li>
- <% if user_signed_in? %>
- Signed in as <%= current_user.email %>
- <% else %>
- <%= link_to "Sign Up", new_user_registration_path %>
- <% end %>
- </li>
+ <% if user_signed_in? %>
+ <li>Signed in as <%= current_user.email %></lI>
+ <% else %>
+ <li><%= link_to "Sign Up", new_user_registration_path %></li>
+ <li><%= link_to "Sign In", new_user_session_path %></li>
+ <% end %>
</ul>
</div>
</div>
@@ -10,4 +10,15 @@ Feature: Signing in
And "nat@baristaschool.com" opens the email with subject "Confirmation instructions"
And they click the first link in the email
Then I should see "Your account was successfully confirmed"
- And I should see "Signed in as nat@baristaschool.com"
+ And I should see "Signed in as nat@baristaschool.com"
+
+ Scenario: Signing in via the web
+ Given there are the following users
+ | email | password |
+ | nat@baristaschool.com | secret |
+ And I am on the homepage
+ When I follow "Sign In"
+ And I fill in "Email" with "nat@baristaschool.com"
+ And I fill in "Password" with "secret"
+ And I press "Sign in"
+ Then I should see "Signed in successfully"
@@ -1,6 +1,8 @@
Given /^there are the following users$/ do |table|
# table is a Cucumber::Ast::Table
table.hashes.each do |attributes|
+ unconfirmed = attributes.delete("unconfirmed") == "true"
@user = User.create!(attributes)
+ @user.confirm! unless unconfirmed
end
end

0 comments on commit 8c4f943

Please sign in to comment.