19 lines
729 B
Ruby
19 lines
729 B
Ruby
require "rails_helper"
|
|
|
|
describe CustomPrimaryKeyRecord, type: :model do
|
|
it { is_expected.to be_versioned }
|
|
|
|
describe "#versions" do
|
|
it "returns instances of CustomPrimaryKeyRecordVersion", versioning: true do
|
|
custom_primary_key_record = described_class.create!
|
|
custom_primary_key_record.update_attributes!(name: "bob")
|
|
version = custom_primary_key_record.versions.last
|
|
expect(version).to be_a(CustomPrimaryKeyRecordVersion)
|
|
version_from_db = CustomPrimaryKeyRecordVersion.last
|
|
expect(version_from_db.reify).to be_a(CustomPrimaryKeyRecord)
|
|
custom_primary_key_record.destroy
|
|
expect(CustomPrimaryKeyRecordVersion.last.reify).to be_a(CustomPrimaryKeyRecord)
|
|
end
|
|
end
|
|
end
|