Add RSpec test case for #404
This commit is contained in:
parent
3da1f104c1
commit
ea38e8a510
|
@ -0,0 +1,19 @@
|
||||||
|
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
|
Loading…
Reference in New Issue