Permalink
Browse files

Added feature for ensuring that a user is signed in

             via a confirmation email by using email spec
  • Loading branch information...
wycats committed Jun 7, 2011
1 parent c7c173d commit f87fa45725ca3daa312f2da19c27a3c65120ee9b
View
@@ -35,5 +35,6 @@ group :test do
gem 'capybara'
gem 'database_cleaner'
gem 'factory_girl'
+ gem 'email_spec'
end
View
@@ -1,71 +1,73 @@
GIT
remote: git://github.com/rack/rack.git
- revision: 4d93f90b58b09329a227fac975228eeef76f2952
+ revision: 404f2f167f9f7d89d0662870ed13cde827703139
specs:
- rack (1.2.1)
+ rack (1.3.0)
GIT
remote: git://github.com/rails/arel.git
- revision: f72989de5b3b3cfb6e6e639b57c3a3bebb2de8f2
+ revision: 593002080cbcbb6e14acf3bc909aab819811f215
specs:
- arel (2.0.7.beta.20110228092631)
+ arel (2.1.1.20110518143805)
GIT
remote: git://github.com/rails/rails.git
- revision: 724a7866774c7847cc79b699ccf7da9fee72b154
+ revision: a1e78cfc36960569cf8cd380d9656ac6c14015ae
specs:
- actionmailer (3.1.0.beta)
- actionpack (= 3.1.0.beta)
- mail (~> 2.2.16)
- actionpack (3.1.0.beta)
- activemodel (= 3.1.0.beta)
- activesupport (= 3.1.0.beta)
+ actionmailer (3.1.0.rc1)
+ actionpack (= 3.1.0.rc1)
+ mail (~> 2.3.0)
+ actionpack (3.1.0.rc1)
+ activemodel (= 3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
builder (~> 3.0.0)
erubis (~> 2.7.0)
- i18n (~> 0.5.0)
- rack (~> 1.2.1)
- rack-cache (~> 1.0.0)
- rack-mount (~> 0.7.1)
- rack-test (~> 0.5.7)
- tzinfo (~> 0.3.23)
- activemodel (3.1.0.beta)
- activesupport (= 3.1.0.beta)
+ i18n (~> 0.6)
+ rack (~> 1.3.0)
+ rack-cache (~> 1.0.1)
+ rack-mount (~> 0.8.1)
+ rack-test (~> 0.6.0)
+ sprockets (~> 2.0.0.beta.10)
+ tzinfo (~> 0.3.27)
+ activemodel (3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
bcrypt-ruby (~> 2.1.4)
builder (~> 3.0.0)
- i18n (~> 0.5.0)
- activerecord (3.1.0.beta)
- activemodel (= 3.1.0.beta)
- activesupport (= 3.1.0.beta)
- arel (~> 2.0.2)
- tzinfo (~> 0.3.23)
- activeresource (3.1.0.beta)
- activemodel (= 3.1.0.beta)
- activesupport (= 3.1.0.beta)
- activesupport (3.1.0.beta)
- multi_json (~> 1.0.0.rc3)
- rails (3.1.0.beta)
- actionmailer (= 3.1.0.beta)
- actionpack (= 3.1.0.beta)
- activerecord (= 3.1.0.beta)
- activeresource (= 3.1.0.beta)
- activesupport (= 3.1.0.beta)
+ i18n (~> 0.6)
+ activerecord (3.1.0.rc1)
+ activemodel (= 3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
+ arel (~> 2.1.1)
+ tzinfo (~> 0.3.27)
+ activeresource (3.1.0.rc1)
+ activemodel (= 3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
+ activesupport (3.1.0.rc1)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ rails (3.1.0.rc1)
+ actionmailer (= 3.1.0.rc1)
+ actionpack (= 3.1.0.rc1)
+ activerecord (= 3.1.0.rc1)
+ activeresource (= 3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
bundler (~> 1.0)
- railties (= 3.1.0.beta)
- railties (3.1.0.beta)
- actionpack (= 3.1.0.beta)
- activesupport (= 3.1.0.beta)
+ railties (= 3.1.0.rc1)
+ railties (3.1.0.rc1)
+ actionpack (= 3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
- thor (~> 0.14.4)
+ thor (~> 0.14.6)
GIT
remote: git://github.com/sstephenson/sprockets.git
- revision: 885a395317831982d0b375f7372287ef22d433c8
+ revision: f34395cdc4db915a8710a73fe676bb68075610e7
specs:
- sprockets (2.0.0)
- hike (>= 0.7.0)
- rack (>= 1.0.0)
- tilt (>= 1.1.0)
+ sprockets (2.0.0.beta.10)
+ hike (~> 1.0)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
GEM
remote: http://rubygems.org/
@@ -82,16 +84,16 @@ GEM
selenium-webdriver (>= 0.0.27)
xpath (~> 0.1.3)
celerity (0.8.9)
- childprocess (0.1.8)
+ childprocess (0.1.9)
ffi (~> 1.0.6)
coffee-script (2.2.0)
coffee-script-source
execjs
- coffee-script-source (1.0.1)
- cucumber (0.10.2)
+ coffee-script-source (1.1.1)
+ cucumber (0.10.6)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
- gherkin (>= 2.3.5)
+ gherkin (~> 2.4.0)
json (>= 1.4.6)
term-ansicolor (>= 1.0.5)
cucumber-rails (0.4.1)
@@ -106,66 +108,67 @@ GEM
warden (~> 1.0.3)
diff-lcs (1.1.2)
dynamic_form (1.1.4)
+ email_spec (1.1.1)
+ rspec (~> 2.0)
erubis (2.7.0)
- execjs (0.2.0)
+ execjs (1.1.0)
+ multi_json (~> 1.0)
factory_girl (1.3.3)
- ffi (1.0.7)
- rake (>= 0.8.7)
- gherkin (2.3.6)
+ ffi (1.0.9)
+ gherkin (2.4.0)
json (>= 1.4.6)
- hike (0.7.1)
- i18n (0.5.0)
+ hike (1.0.0)
+ i18n (0.6.0)
json (1.5.1)
json_pure (1.5.1)
- mail (2.2.17)
- activesupport (>= 2.3.6)
+ mail (2.3.0)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
- multi_json (1.0.0.rc3)
+ multi_json (1.0.3)
nokogiri (1.4.4)
orm_adapter (0.0.5)
polyglot (0.3.1)
- rack-cache (1.0.1)
+ rack-cache (1.0.2)
rack (>= 0.4)
- rack-mount (0.7.2)
+ rack-mount (0.8.1)
rack (>= 1.0.0)
rack-ssl (1.3.2)
rack
- rack-test (0.5.7)
+ rack-test (0.6.0)
rack (>= 1.0)
- rake (0.8.7)
- rspec (2.5.0)
- rspec-core (~> 2.5.0)
- rspec-expectations (~> 2.5.0)
- rspec-mocks (~> 2.5.0)
- rspec-core (2.5.1)
- rspec-expectations (2.5.0)
+ rake (0.9.2)
+ rspec (2.6.0)
+ rspec-core (~> 2.6.0)
+ rspec-expectations (~> 2.6.0)
+ rspec-mocks (~> 2.6.0)
+ rspec-core (2.6.4)
+ rspec-expectations (2.6.0)
diff-lcs (~> 1.1.2)
- rspec-mocks (2.5.0)
- rspec-rails (2.5.0)
+ rspec-mocks (2.6.0)
+ rspec-rails (2.6.1)
actionpack (~> 3.0)
activesupport (~> 3.0)
railties (~> 3.0)
- rspec (~> 2.5.0)
+ rspec (~> 2.6.0)
rubyzip (0.9.4)
- sass (3.1.0.alpha.256)
- selenium-webdriver (0.1.4)
+ sass (3.1.2)
+ selenium-webdriver (0.2.1)
childprocess (>= 0.1.7)
ffi (>= 1.0.7)
json_pure
rubyzip
sqlite3 (1.3.3)
term-ansicolor (1.0.5)
thor (0.14.6)
- tilt (1.2.2)
+ tilt (1.3.2)
treetop (1.4.9)
polyglot (>= 0.3.1)
- tzinfo (0.3.26)
+ tzinfo (0.3.27)
warden (1.0.4)
rack (>= 1.0)
- xpath (0.1.3)
+ xpath (0.1.4)
nokogiri (~> 1.3)
PLATFORMS
@@ -179,6 +182,7 @@ DEPENDENCIES
database_cleaner
devise
dynamic_form
+ email_spec
factory_girl
rack!
rails!
View
@@ -2,7 +2,8 @@ class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
- :recoverable, :rememberable, :trackable, :validatable
+ :recoverable, :rememberable, :trackable,
+ :validatable, :confirmable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me
@@ -15,7 +15,11 @@
<% end %>
<h1><%= link_to "Ticketee", root_path %></h1>
<nav>
- <%= link_to "Sign up", new_user_registration_path %>
+ <% if user_signed_in? %>
+ Signed in as <%= current_user.email %>
+ <% else %>
+ <%= link_to "Sign up", new_user_registration_path %>
+ <% end %>
</nav>
<%= yield %>
</body>
@@ -0,0 +1,7 @@
+class AddConfirmableFieldsToUsers < ActiveRecord::Migration
+ def change
+ add_column :users, :confirmation_token, :string
+ add_column :users, :confirmed_at, :datetime
+ add_column :users, :confirmation_sent_at, :datetime
+ end
+end
View
@@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20110607224324) do
+ActiveRecord::Schema.define(:version => 20110607231443) do
create_table "projects", :force => true do |t|
t.string "name"
@@ -41,6 +41,9 @@
t.string "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
+ t.string "confirmation_token"
+ t.datetime "confirmed_at"
+ t.datetime "confirmation_sent_at"
end
add_index "users", ["email"], :name => "index_users_on_email", :unique => true
@@ -0,0 +1,14 @@
+Feature: Signing in
+ In order to use the site
+ As a user
+ I want to be able to sign in
+
+ Scenario: Signing in via confirmation
+ Given there are the following users:
+ | email | password |
+ | user@ticketee.com | password |
+ And "user@ticketee.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 user@ticketee.com"
+
Oops, something went wrong.

0 comments on commit f87fa45

Please sign in to comment.