Sha256: 074bd6b32dd2617009908cdbc9996649d321158b3dece9e15b78f6191eba6f28

Contents?: true

Size: 945 Bytes

Versions: 5

Compression:

Stored size: 945 Bytes

Contents

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

describe "references" do

  it "should handle complex transitions" do

    @vegetable.foods.count.should == 0
    @fruit.foods.count.should == 0
    @onion.category.should be_nil

    @vegetable.foods << @onion

    @vegetable.foods.count.should == 1
    @vegetable.foods.first.should == @onion
    @fruit.foods.count.should == 0
    @onion.category.should == @vegetable

    @fruit.foods << @onion

    @vegetable.foods.count.should == 0
    @fruit.foods.count.should == 1
    @fruit.foods.first.should == @onion
    @onion.category.should == @fruit

    @onion.category = nil

    @vegetable.foods.count.should == 0
    @fruit.foods.count.should == 0
    @onion.category.should be_nil

    @onion.category = @vegetable

    @vegetable.foods.count.should == 1
    @vegetable.foods.first.should == @onion
    @fruit.foods.count.should == 0
    @onion.category.should == @vegetable

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
blendris-0.5 spec/ref_spec.rb
blendris-0.0.4 spec/ref_spec.rb
blendris-0.0.3 spec/ref_spec.rb
blendris-0.0.2 spec/ref_spec.rb
blendris-0.0.1 spec/ref_spec.rb