Sha256: d9bdc621014e755fdc32f5fda6cce7f495537e9df45462263573b4b34a0b98fc

Contents?: true

Size: 868 Bytes

Versions: 14

Compression:

Stored size: 868 Bytes

Contents

# frozen_string_literal: true

module Shared
  module NoAddition
    def setup
      (1..4).each { |counter| NoAdditionMixin.create! pos: counter, parent_id: 5 }
    end

    def test_insert
      new = NoAdditionMixin.create(parent_id: 20)
      assert_nil new.pos
      assert !new.in_list?

      new = NoAdditionMixin.create(parent_id: 20)
      assert_nil new.pos
    end

    def test_update_does_not_add_to_list
      new = NoAdditionMixin.create(parent_id: 20)
      new.update_attribute(:updated_at, Time.now) # force some change
      new.reload

      assert !new.in_list?
    end

    def test_update_scope_does_not_add_to_list
      new = NoAdditionMixin.create

      new.update_attribute(:parent_id, 20)
      new.reload
      assert !new.in_list?

      new.update_attribute(:parent_id, 5)
      new.reload
      assert !new.in_list?
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
acts_as_list-1.0.4 test/shared_no_addition.rb
acts_as_list-1.0.3 test/shared_no_addition.rb
acts_as_list-1.0.2 test/shared_no_addition.rb
acts_as_list-1.0.1 test/shared_no_addition.rb
acts_as_list-1.0.0 test/shared_no_addition.rb
acts_as_list-0.9.19 test/shared_no_addition.rb
acts_as_list-0.9.18 test/shared_no_addition.rb
acts_as_list-0.9.17 test/shared_no_addition.rb
acts_as_list-0.9.16 test/shared_no_addition.rb
acts_as_list-0.9.15 test/shared_no_addition.rb
acts_as_list-0.9.14 test/shared_no_addition.rb
acts_as_list-0.9.13 test/shared_no_addition.rb
acts_as_list-0.9.12 test/shared_no_addition.rb
acts_as_list-0.9.11 test/shared_no_addition.rb