Permalink
Browse files

renamed username to uid

  • Loading branch information...
1 parent 3646abc commit 410ffbc2a99809a687b5a521869275e276765175 @bcardarella bcardarella committed Dec 13, 2012
@@ -1,14 +1,14 @@
class CreateEasyAuthIdentities < ActiveRecord::Migration
def change
create_table :identities do |t|
- t.string :username
+ t.string :uid
t.string :token
t.string :account_type
t.integer :account_id
t.string :type
t.timestamps
end
- add_index :identities, :username
+ add_index :identities, :uid
end
end
@@ -3,7 +3,7 @@ module EasyAuth::Models::Identity
reverse_included do
belongs_to :account, :polymorphic => true
- validates :username, :uniqueness => { :scope => :type }, :presence => true
+ validates :uid, :uniqueness => { :scope => :type }, :presence => true
end
module ClassMethods
@@ -14,7 +14,7 @@
ActiveRecord::Schema.define(:version => 20120227014023) do
create_table "identities", :force => true do |t|
- t.string "username"
+ t.string "uid"
t.string "token"
t.string "account_type"
t.integer "account_id"
@@ -23,7 +23,7 @@
t.datetime "updated_at", :null => false
end
- add_index "identities", ["username"], :name => "index_identities_on_username"
+ add_index "identities", ["uid"], :name => "index_identities_on_uid"
create_table "users", :force => true do |t|
t.string "email"
@@ -1,13 +1,13 @@
require 'spec_helper'
describe EasyAuth::Models::Identity do
- describe 'username' do
+ describe 'uid' do
subject { Identity.new }
before do
- Identity.create(:username => 'testuser')
- TestIdentity.create(:username => 'otheruser')
+ Identity.create(:uid => 'testuser')
+ TestIdentity.create(:uid => 'otheruser')
end
- it { should have_valid(:username).when('otheruser') }
- it { should_not have_valid(:username).when(nil, '', 'testuser') }
+ it { should have_valid(:uid).when('otheruser') }
+ it { should_not have_valid(:uid).when(nil, '', 'testuser') }
end
end
@@ -1,6 +1,6 @@
FactoryGirl.define do
factory :user do
email 'test@example.com'
- identities { [TestIdentity.new(:username => 'testuser')] }
+ identities { [TestIdentity.new(:uid => 'testuser')] }
end
end

0 comments on commit 410ffbc

Please sign in to comment.