diff --git a/Gemfile b/Gemfile index 452bda8c3703c25b55a9f766f6b39f12116838a8..9d0bb289b03961d8bab7ebb3213395e70ebd8f28 100644 --- a/Gemfile +++ b/Gemfile @@ -11,8 +11,8 @@ gem 'nokogiri', '1.4.3.1' gem "fog" #Security -gem 'devise', '1.2.rc' -gem 'devise_invitable', :git => 'git://github.com/zhitomirskiyi/devise_invitable.git' +gem 'devise', '1.1.3' +gem 'devise_invitable', :git => 'git://github.com/zhitomirskiyi/devise_invitable.git', :branch => '0.3.5' #Authentication gem 'omniauth', '0.1.6' diff --git a/Gemfile.lock b/Gemfile.lock index cd3bc1cce4cb52c0a1c7ab5181b056a57a308d5e..f34274e94c65e0713b7b9d04a9645f5a43c674f4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -46,11 +46,11 @@ GIT GIT remote: git://github.com/zhitomirskiyi/devise_invitable.git - revision: 5f74da32a81a2332bac266316dab333a4eed9525 + revision: 85abb5fef4ab4f74db818ed3d8104c2f7d24b94e + branch: 0.3.5 specs: - devise_invitable (0.4.rc) - devise (~> 1.2.rc) - rails (~> 3.0.0) + devise_invitable (0.3.5) + devise (~> 1.1.0) PATH remote: vendor/gems/jasmine @@ -145,10 +145,9 @@ GEM culerity (0.2.15) daemons (1.1.0) database_cleaner (0.6.0) - devise (1.2.rc) + devise (1.1.3) bcrypt-ruby (~> 2.1.2) - orm_adapter (~> 0.0.2) - warden (~> 1.0.2) + warden (~> 0.10.7) diff-lcs (1.1.2) erubis (2.6.6) abstract (>= 1.0.0) @@ -264,7 +263,6 @@ GEM oa-enterprise (= 0.1.6) oa-oauth (= 0.1.6) oa-openid (= 0.1.6) - orm_adapter (0.0.4) polyglot (0.3.1) pyu-ruby-sasl (0.0.3.2) rack (1.2.1) @@ -351,7 +349,7 @@ GEM uuidtools (2.1.1) vegas (0.1.8) rack (>= 1.0.0) - warden (1.0.3) + warden (0.10.7) rack (>= 1.0.0) webmock (1.6.2) addressable (>= 2.2.2) @@ -374,7 +372,7 @@ DEPENDENCIES cloudfiles (= 1.4.10) cucumber-rails (= 0.3.2) database_cleaner (= 0.6.0) - devise (= 1.2.rc) + devise (= 1.1.3) devise_invitable! em-websocket! factory_girl_rails diff --git a/app/models/invitation.rb b/app/models/invitation.rb index 4e6d3a56497c8c210d7585c53e4f9303c7060ce4..134cb28cf824224474c59d058beefbc533b06f0a 100644 --- a/app/models/invitation.rb +++ b/app/models/invitation.rb @@ -71,8 +71,6 @@ class Invitation < ActiveRecord::Base opts[:from].save! invitee.reload end - pp opts[:service] - pp opts[:service] == 'email' invitee.invite!(:email => (opts[:service] == 'email')) Rails.logger.info("event=invitation_sent to=#{opts[:identifier]} #{"inviter=#{opts[:from].diaspora_handle}" if opts[:from]}") invitee diff --git a/db/migrate/20110126225202_remove_unique_index_on_email_on_users.rb b/db/migrate/20110126225202_remove_unique_index_on_email_on_users.rb new file mode 100644 index 0000000000000000000000000000000000000000..28f620683e67146281afce6a9f77048cb93c4ff8 --- /dev/null +++ b/db/migrate/20110126225202_remove_unique_index_on_email_on_users.rb @@ -0,0 +1,11 @@ +class RemoveUniqueIndexOnEmailOnUsers < ActiveRecord::Migration + def self.up + remove_index :users, :email + add_index :users, :email + end + + def self.down + remove_index :users, :email + add_index :users, :email, :unique => true + end +end diff --git a/db/schema.rb b/db/schema.rb index 6695d5187e5b7bb563dc7a2ce2a03698abcb943f..85b57776edb966b927563a0788ffa5445fc8e8ae 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20110126015407) do +ActiveRecord::Schema.define(:version => 20110126225202) do create_table "aspect_memberships", :force => true do |t| t.integer "aspect_id" @@ -273,7 +273,8 @@ ActiveRecord::Schema.define(:version => 20110126015407) do t.string "language" t.string "email", :default => "", :null => false t.string "encrypted_password", :limit => 128, :default => "", :null => false - t.string "invitation_token", :limit => 60 + t.string "password_salt", :default => "", :null => false + t.string "invitation_token", :limit => 20 t.datetime "invitation_sent_at" t.string "reset_password_token" t.string "remember_token" @@ -433,7 +434,8 @@ ActiveRecord::Schema.define(:version => 20110126015407) do t.string "language" t.string "email", :default => "", :null => false t.string "encrypted_password", :limit => 128, :default => "", :null => false - t.string "invitation_token", :limit => 60 + t.string "password_salt", :default => "", :null => false + t.string "invitation_token", :limit => 20 t.datetime "invitation_sent_at" t.string "reset_password_token" t.string "remember_token" @@ -450,7 +452,7 @@ ActiveRecord::Schema.define(:version => 20110126015407) do t.string "invitation_identifier" end - add_index "users", ["email"], :name => "index_users_on_email", :unique => true + add_index "users", ["email"], :name => "index_users_on_email" add_index "users", ["invitation_token"], :name => "index_users_on_invitation_token" add_index "users", ["mongo_id"], :name => "index_users_on_mongo_id" add_index "users", ["username"], :name => "index_users_on_username", :unique => true diff --git a/spec/models/invitation_spec.rb b/spec/models/invitation_spec.rb index b7aa1b6e33bc3d55c5eeea910e079eecf14b79a0..4c7ebe3dec81a3911380c27c9ef53cc3e5441124 100644 --- a/spec/models/invitation_spec.rb +++ b/spec/models/invitation_spec.rb @@ -239,7 +239,6 @@ describe Invitation do it 'mails the optional message' do new_user = Invitation.create_invitee(@valid_params) - pp Devise.mailer.deliveries Devise.mailer.deliveries.first.to_s.include?(@message).should be_true end @@ -257,7 +256,11 @@ describe Invitation do it 'does not save a user with an empty string email' do @valid_params[:service] = 'facebook' @valid_params[:identifier] = '3423423' - Invitation.create_invitee(@valid_params).email.should_not == '' + Invitation.create_invitee(@valid_params) + @valid_params[:identifier] = 'dfadsfdas' + lambda { + Invitation.create_invitee(@valid_params) + }.should_not raise_error end end