Skip to content
This repository was archived by the owner on Apr 17, 2018. It is now read-only.
This repository was archived by the owner on Apr 17, 2018. It is now read-only.

move :below fails #3

@FND

Description

@FND

test case: https://github.com/FND/dm-is-list/compare/below_bug

the first .move :below fails - yet it succeeds if first doing an arbitrary .move :above

Since the RSpec test case seems potentially confusing, here's a sample script that might make it clearer:

module DEBUG

  def self.info
    puts Animal.all(:order => :position.asc).map(&:id).join("  ")
  end

  def self.move(id, vector, ref_id)
    puts Animal.get!(id).move vector => Animal.get!(ref_id)
  end

end

5.times do |i|
  name = "animal#{i}"
  Animal.create
end

DEBUG::info # 1  2  3  4  5
DEBUG::move 5, :below, 1 # false
DEBUG::info # 1  2  3  4  5
DEBUG::move 5, :above, 1 # true
DEBUG::info # 5  1  2  3  4
DEBUG::move 5, :below, 1 # true
DEBUG::info # 1  5  2  3  4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions