Sha256: a85f68d0863dda620e87991d844b580c7cf5d13b32620b111858d88da09e97b6

Contents?: true

Size: 1005 Bytes

Versions: 5

Compression:

Stored size: 1005 Bytes

Contents

require_relative "test_helper"

class DeepNestingTest < ActiveSupport::TestCase
  test "archiving deeply nested items" do
    archival   = Archival.create!
    child      = archival.archivals.create!
    grandchild = child.archivals.create!
    archival.archive
    assert archival.reload.archived?
    assert child.reload.archived?
    assert grandchild.reload.archived?
    assert_equal archival.archive_number, child.archive_number
    assert_equal archival.archive_number, grandchild.archive_number
  end

  test "unarchiving deeply nested items doesn't blow up" do
    archival_attributes = {
      :archived_at => Time.now,
      :archive_number => "test"
    }
    archival   = Archival.create!(archival_attributes)
    child      = archival.archivals.create!(archival_attributes)
    grandchild = child.archivals.create!(archival_attributes)
    archival.unarchive
    assert_not archival.reload.archived?
    assert_not child.reload.archived?
    assert_not grandchild.reload.archived?
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
acts_as_archival-1.1.1 test/deep_nesting_test.rb
acts_as_archival-1.1.0 test/deep_nesting_test.rb
acts_as_archival-1.0.0 test/deep_nesting_test.rb
acts_as_archival-0.6.1 test/deep_nesting_test.rb
acts_as_archival-0.6.0 test/deep_nesting_test.rb