mirror of
https://github.com/paper-trail-gem/paper_trail.git
synced 2022-11-09 11:33:19 -05:00
38fa23873c
The reason some projects have both is so that some spec files can be run in isolation, without the rails stuff. In practice, I don't find myself ever doing this. So, the complexity of two files is unnecessary.
22 lines
633 B
Ruby
22 lines
633 B
Ruby
require "spec_helper"
|
|
|
|
RSpec.describe NotOnUpdate, type: :model do
|
|
describe "#touch_with_version", versioning: true do
|
|
let!(:record) { described_class.create! }
|
|
|
|
it "creates a version, regardless" do
|
|
expect { record.paper_trail.touch_with_version }.to change {
|
|
PaperTrail::Version.count
|
|
}.by(+1)
|
|
end
|
|
|
|
it "increments the `:updated_at` timestamp" do
|
|
before = record.updated_at
|
|
# Travel 1 second because MySQL lacks sub-second resolution
|
|
Timecop.travel(1) do
|
|
record.paper_trail.touch_with_version
|
|
end
|
|
expect(record.updated_at).to be > before
|
|
end
|
|
end
|
|
end
|