Sha256: 6e69cb4312ca1a5284d286d80f044def5292f696238d99d0f6f2b4a2690bc8fd

Contents?: true

Size: 830 Bytes

Versions: 4

Compression:

Stored size: 830 Bytes

Contents

require "rails_helper"

# This model is in the test suite soley for the purpose of testing ActiveRecord::Enum,
# which is available in ActiveRecord4+ only
describe PostWithStatus, type: :model do
  if defined?(ActiveRecord::Enum)
    with_versioning do
      let(:post) { PostWithStatus.create!(status: "draft") }

      it "should stash the enum value properly in versions" do
        post.published!
        post.archived!
        expect(post.previous_version.published?).to be true
      end

      context "storing enum object_changes" do
        subject { post.versions.last }

        it "should stash the enum value properly in versions object_changes" do
          post.published!
          post.archived!
          expect(subject.changeset["status"]).to eql %w(published archived)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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