Sha256: a3e9a6b962c336c74fffffe88d7d2c801e179a45bdd523d65dc416700e90d867

Contents?: true

Size: 1.04 KB

Versions: 12

Compression:

Stored size: 1.04 KB

Contents

require "rails_helper"

describe PaperTrail::VersionConcern do
  before(:all) { require "support/alt_db_init" }

  it "allows included class to have different connections" do
    expect(Foo::Version.connection).not_to eq(Bar::Version.connection)
  end

  it "allows custom version class to share connection with superclass" do
    expect(Foo::Version.connection).to eq(Foo::Document.connection)
    expect(Bar::Version.connection).to eq(Bar::Document.connection)
  end

  it "can be used with class_name option" do
    expect(Foo::Document.version_class_name).to eq("Foo::Version")
    expect(Bar::Document.version_class_name).to eq("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
      expect(@foo_doc.versions.first).to be_instance_of(Foo::Version)
      expect(@bar_doc.versions.first).to be_instance_of(Bar::Version)
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/paper_trail-5.2.3/spec/modules/version_concern_spec.rb
paper_trail-6.0.2 spec/modules/version_concern_spec.rb
paper_trail-6.0.1 spec/modules/version_concern_spec.rb
paper_trail-6.0.0 spec/modules/version_concern_spec.rb
paper_trail-5.2.3 spec/modules/version_concern_spec.rb
paper_trail-5.2.2 spec/modules/version_concern_spec.rb
paper_trail-5.2.1 spec/modules/version_concern_spec.rb
paper_trail-5.2.0 spec/modules/version_concern_spec.rb
paper_trail-5.1.1 spec/modules/version_concern_spec.rb
paper_trail-5.1.0 spec/modules/version_concern_spec.rb
paper_trail-5.0.1 spec/modules/version_concern_spec.rb
paper_trail-5.0.0 spec/modules/version_concern_spec.rb