Skip to content
This repository
Browse code

[#206] Improve data integrity

By default, we want email, encrypted_password, and remember_token to
enforce a NOT NULL constraint.
  • Loading branch information...
commit fd6fbc067b93825cfb9243a208395312aa6c1fca 1 parent 564b859
Dan Croak authored July 21, 2012
18  db/migrate/20110111224543_create_clearance_users.rb
... ...
@@ -0,0 +1,18 @@
  1
+class CreateClearanceUsers < ActiveRecord::Migration
  2
+  def self.up
  3
+    create_table :users  do |t|
  4
+      t.timestamps :null => false
  5
+      t.string :email, :null => false
  6
+      t.string :encrypted_password, :limit => 128, :null => false
  7
+      t.string :confirmation_token, :limit => 128
  8
+      t.string :remember_token, :limit => 128, :null => false
  9
+    end
  10
+
  11
+    add_index :users, :email
  12
+    add_index :users, :remember_token
  13
+  end
  14
+
  15
+  def self.down
  16
+    drop_table :users
  17
+  end
  18
+end
18  db/migrate/20110111224543_create_diesel_clearance_users.rb
... ...
@@ -1,18 +0,0 @@
1  
-class CreateDieselClearanceUsers < ActiveRecord::Migration
2  
-  def self.up
3  
-    create_table(:users) do |t|
4  
-      t.string   :email
5  
-      t.string   :encrypted_password, :limit => 128
6  
-      t.string   :confirmation_token, :limit => 128
7  
-      t.string   :remember_token,     :limit => 128
8  
-      t.timestamps
9  
-    end
10  
-
11  
-    add_index :users, :email
12  
-    add_index :users, :remember_token
13  
-  end
14  
-
15  
-  def self.down
16  
-    drop_table :users
17  
-  end
18  
-end
7  features/engine/visitor_resets_password.feature
@@ -32,10 +32,3 @@ Feature: Password reset
32 32
     When I sign in with "email@example.com" and "newpassword"
33 33
     Then I should be signed in
34 34
 
35  
-  Scenario: User who was created before Clearance was installed creates password for first time
36  
-    Given a user "email@example.com" exists without a remember token or password
37  
-    When I reset the password for "email@example.com"
38  
-    When I follow the password reset link sent to "email@example.com"
39  
-    And I update my password with "newpassword"
40  
-    Then I should be signed in
41  
-
6  features/step_definitions/engine/clearance_steps.rb
@@ -6,12 +6,6 @@
6 6
   FactoryGirl.create :user, :email => email
7 7
 end
8 8
 
9  
-Given /^a user "([^"]*)" exists without a remember token or password$/ do |email|
10  
-  user = FactoryGirl.create(:user, :email => email)
11  
-  sql  = "update users set encrypted_password = NULL, remember_token = NULL where id = #{user.id}"
12  
-  ActiveRecord::Base.connection.update sql
13  
-end
14  
-
15 9
 # Sign up
16 10
 
17 11
 When /^I sign up (?:with|as) "(.*)" and "(.*)"$/ do |email, password|

0 notes on commit fd6fbc0

Please sign in to comment.
Something went wrong with that request. Please try again.