Sha256: c46dfb06131e607cd9af6d505712ca7b9c7ed742e37e14f0c162921989f6b91e

Contents?: true

Size: 1.29 KB

Versions: 4

Compression:

Stored size: 1.29 KB

Contents

require_relative "test_helper"

class ActsAsArchivalTest < ActiveSupport::TestCase
  test "simple unarchived scope" do
    Archival.create!
    Archival.create!

    assert_equal 2, Archival.unarchived.count
  end

  test "simple archived scope" do
    Archival.create!.archive
    Archival.create!.archive

    assert_equal 2, Archival.archived.count
  end

  test "mixed scopes" do
    Archival.create!
    Archival.create!.archive

    assert_equal 1, Archival.archived.count
    assert_equal 1, Archival.unarchived.count
  end

  test "simple archived_from_archive_number" do
    archive_number = "TEST-IT"
    Archival.create!.archive(archive_number)
    Archival.create!.archive(archive_number)

    assert_equal 2, Archival.archived_from_archive_number(archive_number).count
  end

  test "negative archived_from_archive_number" do
    archive_number = "TEST-IT"
    bogus_number = "BROKE-IT"
    Archival.create!.archive(archive_number)
    Archival.create!.archive(archive_number)

    assert_equal 0, Archival.archived_from_archive_number(bogus_number).count
  end

  test "mixed archived_from_archive_number" do
    archive_number = "TEST-IT"
    Archival.create!.archive(archive_number)
    Archival.create!.archive

    assert_equal 1, Archival.archived_from_archive_number(archive_number).count
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
acts_as_archival-0.5.0 test/scope_test.rb
acts_as_archival-0.4.2 test/scope_test.rb
acts_as_archival-0.4.1 test/scope_test.rb
acts_as_archival-0.4.0 test/scope_test.rb