Sha256: de49452b5b7c4cd669b4f407612099828e41f487c47c7e5725a1d27612f3481f

Contents?: true

Size: 1.37 KB

Versions: 11

Compression:

Stored size: 1.37 KB

Contents

# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
#
# Fat Free CRM is freely distributable under the terms of MIT license.
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
# == Schema Information
#
# Table name: avatars
#
#  id                 :integer         not null, primary key
#  user_id            :integer
#  entity_id          :integer
#  entity_type        :string(255)
#  image_file_size    :integer
#  image_file_name    :string(255)
#  image_content_type :string(255)
#  created_at         :datetime
#  updated_at         :datetime
#

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe Avatar do
  before(:each) do
    @user = FactoryGirl.create(:user)
  end

  it "should create a new instance given valid attributes" do
    FactoryGirl.create(:avatar, :entity => @user).should be_valid
  end

  it "user should have one avatar as entity" do
    avatar = FactoryGirl.create(:avatar, :entity => @user)
    @user.avatar.should == avatar
  end

  it "user might have many avatars as owner" do
    avatars = [
      FactoryGirl.create(:avatar, :user=> @user, :entity => FactoryGirl.create(:user)),
      FactoryGirl.create(:avatar, :user=> @user, :entity => FactoryGirl.create(:user))
    ]
    @user.avatars.should == avatars
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
fat_free_crm-0.13.6 spec/models/polymorphic/avatar_spec.rb
fat_free_crm-0.13.5 spec/models/polymorphic/avatar_spec.rb
fat_free_crm-0.13.4 spec/models/polymorphic/avatar_spec.rb
fat_free_crm-0.13.3 spec/models/polymorphic/avatar_spec.rb
fat_free_crm-0.13.2 spec/models/polymorphic/avatar_spec.rb
fat_free_crm-0.12.3 spec/models/polymorphic/avatar_spec.rb
fat_free_crm-0.12.2 spec/models/polymorphic/avatar_spec.rb
fat_free_crm-0.13.1 spec/models/polymorphic/avatar_spec.rb
fat_free_crm-0.12.1 spec/models/polymorphic/avatar_spec.rb
fat_free_crm-0.13.0 spec/models/polymorphic/avatar_spec.rb
fat_free_crm-0.12.0 spec/models/polymorphic/avatar_spec.rb