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.11 spec/models/social_account_spec.rb
iugusdk-1.0.10 spec/models/social_account_spec.rb
iugusdk-1.0.9 spec/models/social_account_spec.rb
iugusdk-1.0.8 spec/models/social_account_spec.rb
iugusdk-1.0.7 spec/models/social_account_spec.rb
iugusdk-1.0.6 spec/models/social_account_spec.rb
iugusdk-1.0.5 spec/models/social_account_spec.rb
iugusdk-1.0.4 spec/models/social_account_spec.rb
iugusdk-1.0.3 spec/models/social_account_spec.rb
iugusdk-1.0.2 spec/models/social_account_spec.rb
iugusdk-1.0.1 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.32 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.31 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.30 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.29 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.28 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.27 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.26 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.25 spec/models/social_account_spec.rb
iugusdk-1.0.0.alpha.24 spec/models/social_account_spec.rb