Sha256: cf2a62f22b1874f1618486149605ddb7fc07f1b9f73040115f6bcb50e5e678fd

Contents?: true

Size: 701 Bytes

Versions: 9

Compression:

Stored size: 701 Bytes

Contents

require_relative "test_helper"

class ReadonlyWhenArchivedTest < ActiveSupport::TestCase
  test "acts_as_archival objects can normally be altered after archive" do
    archival = Archival.create!(:name => "original")
    archival.archive
    archival.name = "updated"
    archival.save!

    assert_equal "updated", archival.reload.name
  end

  test "acts_as_archival marked as readonly_when_archived cannot be updated after archive" do
    archival = ReadonlyWhenArchived.create!(:name => "original")
    archival.archive
    archival.name = "updated"

    assert_not archival.save
    assert_equal "Cannot modify an archived record.",
                 archival.errors.full_messages.first
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
acts_as_archival-1.1.1 test/readonly_when_archived_test.rb
acts_as_archival-1.1.0 test/readonly_when_archived_test.rb
acts_as_archival-1.0.0 test/readonly_when_archived_test.rb
acts_as_archival-0.6.1 test/readonly_when_archived_test.rb
acts_as_archival-0.6.0 test/readonly_when_archived_test.rb
acts_as_archival-0.5.3 test/readonly_when_archived_test.rb
acts_as_archival-0.5.2 test/readonly_when_archived_test.rb
acts_as_archival-0.5.1 test/readonly_when_archived_test.rb
acts_as_archival-0.5.0 test/readonly_when_archived_test.rb