Sha256: 5d27e1516b4436b90e095e60783bd32ad7b57eadfe7fe54eece7e6aaf50b1b04

Contents?: true

Size: 1.2 KB

Versions: 41

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'

describe SocialAccount do
  it { should belong_to :user }

  it 'cant be unlinked if the user has no email and its the last social' do
    @user = Fabricate.build(:user_without_email)
    @user.password = "secret_password"
    @user.password_confirmation = "secret_password"
    @user.skip_confirmation!
    @user.save(:validate => false)
    @user.social_accounts << Fabricate(:social_account_without_user)
    User.find(@user.id).social_accounts.first.unlink.should be_false
  end

  it 'cant be unlinked if the user has no password and its the last social' do
    @social_account = Fabricate(:social_account)
    @user = @social_account.user
    @user.email = "testing@email.test"
    @user.password = ""
    @user.password_confirmation = ""
    @user.encrypted_password = ""
    @user.save(:validate => false)
    @social_account.unlink.should be_false
  end

  it 'can be unlinked if the user has email/password and its the last social' do
    @social_account = Fabricate(:social_account)
    @user = @social_account.user
    @user.email = "testing@email.test"
    @user.password = "12345678"
    @user.password_confirmation = "12345678"
    @user.save
    @social_account.unlink.should be_true
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
iugusdk-1.0.0.alpha.23 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.22 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.21 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.20 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.19 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.18 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.17 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.16 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.14 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.13 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.12 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.11 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.10 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.9 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.7 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.5 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.4 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.3 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.2 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.1 spec/models/social_account_spec.rb