Sha256: 2aa5b1385cd36d0eac31a495f00e7f62942330ac01b9870b1e2208700c69235c

Contents?: true

Size: 610 Bytes

Versions: 4

Compression:

Stored size: 610 Bytes

Contents

require "rails_helper"

describe NotOnUpdate, type: :model do
  describe "#touch_with_version", versioning: true do
    let!(:record) { described_class.create! }

    it "should create a version, regardless" do
      expect { record.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.touch_with_version
      end
      expect(record.updated_at).to be > before
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
paper_trail-5.1.1 spec/models/not_on_update_spec.rb
paper_trail-5.1.0 spec/models/not_on_update_spec.rb
paper_trail-5.0.1 spec/models/not_on_update_spec.rb
paper_trail-5.0.0 spec/models/not_on_update_spec.rb