require 'spec_helper'

describe User do
  let(:user){ build :user }
  describe '#supplier_name' do
    it "displays the auth data name if available" do
      user.auth_data = {'info' => {'name' => 'Benji setup'}}
      user.supplier_name.should == 'Benji setup'
    end

    it 'falls back to unkown if not present' do
      user.supplier_name.should == I18n.t('user.unknown_supplier_name')
    end
  end

  describe '#friends_name' do
    it "displays the auth data nickname if available" do
      user.auth_data = {'info' => {'name' => 'Benji setup', 'nickname' => 'Benji'}}
      user.friends_name.should == 'Benji'
    end

    it 'falls back to unkown if not present' do
      user.friends_name.should == ''
    end
  end
end
