Sha256: e9aaa8c6e8ef32270aad15e0ce0b06e2e8ca2b8a25f525c378b372bc4bff4a8b

Contents?: true

Size: 540 Bytes

Versions: 1

Compression:

Stored size: 540 Bytes

Contents

require 'spec_helper'

describe Bento::Models::User do
  describe ".fake_belongs_to" do
    let(:user) { User.make }
    let(:account) { Account.make }
    before do
      User.class_eval { fake_belongs_to(:account) }
      user.accounts << account
    end

    it "defines #account" do
      user.account.should == account
    end

    it "defines #account=" do
      other_account = Account.make
      user.account = other_account

      user.reload.account.should == other_account
      user.accounts.length.should == 1
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bento-0.0.3 spec/bento/models/user_spec.rb