1
0
Fork 0
mirror of https://github.com/paper-trail-gem/paper_trail.git synced 2022-11-09 11:33:19 -05:00
paper-trail-gem--paper_trail/spec/models/thing_spec.rb

19 lines
563 B
Ruby

# frozen_string_literal: true
require "spec_helper"
RSpec.describe Thing, type: :model do
describe "#versions", versioning: true do
let(:thing) { Thing.create! }
it "applies the scope option" do
expect(Thing.reflect_on_association(:versions).scope).to be_a Proc
expect(thing.versions.to_sql).to end_with "ORDER BY id desc"
end
it "applies the extend option" do
expect(thing.versions.singleton_class).to be < PrefixVersionsInspectWithCount
expect(thing.versions.inspect).to start_with("1 versions:")
end
end
end