Sha256: 0804a3b138bbbadc10bd35543560449b961f814e2fc02870dbd20313dc1cba54

Contents?: true

Size: 515 Bytes

Versions: 5

Compression:

Stored size: 515 Bytes

Contents

require 'rails_helper'

describe Animal, :type => :model do
  it { is_expected.to be_versioned }

  describe "STI", :versioning => true do
    it { expect(Animal.inheritance_column).to eq('species') }

    describe "updates to the `inheritance_column`" do
      subject { Cat.create!(:name => 'Leo') }

      it "should be allowed" do
        subject.update_attributes(:name => 'Spike', :species => 'Dog')
        dog = Animal.find(subject.id)
        expect(dog).to be_instance_of(Dog)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
paper_trail-4.0.2 spec/models/animal_spec.rb
paper_trail-4.0.1 spec/models/animal_spec.rb
paper_trail-4.0.0 spec/models/animal_spec.rb
paper_trail-4.0.0.rc2 spec/models/animal_spec.rb
paper_trail-4.0.0.rc1 spec/models/animal_spec.rb