Sha256: 60435ef0c173626bd655fc3e0306d48bf3c6eaff851631abd0b513f38eeddd8a

Contents?: true

Size: 1.02 KB

Versions: 8

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

describe PaperTrail::VersionConcern do

  before(:all) { require 'support/alt_db_init' }

  it 'allows included class to have different connections' do
    Foo::Version.connection.should_not == Bar::Version.connection
  end

  it 'allows custom version class to share connection with superclass' do
    Foo::Version.connection.should == Foo::Document.connection
    Bar::Version.connection.should == Bar::Document.connection
  end

  it 'can be used with class_name option' do
    Foo::Document.version_class_name.should == 'Foo::Version'
    Bar::Document.version_class_name.should == 'Bar::Version'
  end

  describe 'persistence', :versioning => true do
    before do
      @foo_doc = Foo::Document.create!(:name => 'foobar')
      @bar_doc = Bar::Document.create!(:name => 'raboof')
    end

    it 'should store versions in the correct corresponding db location' do
      @foo_doc.versions.first.should be_instance_of(Foo::Version)
      @bar_doc.versions.first.should be_instance_of(Bar::Version)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
paper_trail-3.0.9 spec/modules/version_concern_spec.rb
paper_trail-3.0.8 spec/modules/version_concern_spec.rb
paper_trail-3.0.7 spec/modules/version_concern_spec.rb
paper_trail-3.0.6 spec/modules/version_concern_spec.rb
paper_trail-3.0.5 spec/modules/version_concern_spec.rb
paper_trail-3.0.2 spec/modules/version_concern_spec.rb
paper_trail-3.0.1 spec/modules/version_concern_spec.rb
paper_trail-3.0.0 spec/modules/version_concern_spec.rb