Sha256: 5783c3038602ecb871efcf55357d13a97dee9440d3c6c55a510fc52477b99a7a
Contents?: true
Size: 1.39 KB
Versions: 6
Compression:
Stored size: 1.39 KB
Contents
require_relative "test_helper" class PolymorphicTest < ActiveSupport::TestCase test "archive item with polymorphic association" do archival = Archival.create! poly = archival.polys.create! archival.archive! assert archival.reload.archived? assert poly.reload.archived? end test "does not archive polymorphic association of different item with same id" do archival = Archival.create! another_polys_holder = AnotherPolysHolder.create!(id: archival.id) poly = another_polys_holder.polys.create! archival.archive! assert_not poly.reload.archived? end test "unarchive item with polymorphic association" do archive_attributes = { archive_number: "test", archived_at: Time.now } archival = Archival.create!(archive_attributes) poly = archival.polys.create!(archive_attributes) archival.unarchive! assert_not archival.reload.archived? assert_not poly.reload.archived? end test "does not unarchive polymorphic association of different item with same id" do archive_attributes = { archive_number: "test", archived_at: Time.now } archival = Archival.create!(archive_attributes) another_polys_holder = AnotherPolysHolder.create!(archive_attributes.merge(id: archival.id)) poly = another_polys_holder.polys.create!(archive_attributes) archival.unarchive! assert poly.reload.archived? end end
Version data entries
6 entries across 6 versions & 2 rubygems