Sha256: 71ba2fa3bb0f0f39d04cf3c22095c398e5040b53012798bcbcdde1867cff6d03

Contents?: true

Size: 619 Bytes

Versions: 4

Compression:

Stored size: 619 Bytes

Contents

require File.join(File.dirname(__FILE__), 'spec_helper')

describe "HasManyVersions deleting" do

  before(:each) do
    Database.reset!
  end
  
  it "should delete from the associations and increment the version" do
    jasper = Author.new(:name => 'Jasper Fforde')
    eyre_affair = Book.new(:name => "The Eyre Affair")
    shades_of_grey = Book.new(:name => "Shades of Grey")
    jasper.save!
    jasper.books.push(eyre_affair, shades_of_grey)
    initial_version = jasper.version
    jasper.books.delete(eyre_affair)
    jasper.books.should == [shades_of_grey]
    jasper.books.first.version.should == 3
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
joshbuddy-has_many_versions-0.0.4 spec/delete_spec.rb
joshbuddy-has_many_versions-0.0.6 spec/delete_spec.rb
joshbuddy-has_many_versions-0.0.7 spec/delete_spec.rb
has_many_versions-0.0.7 spec/delete_spec.rb