Sha256: a184871d3d70c42a9ddf092b479e20400c985e7005be3b909463621d16048abc

Contents?: true

Size: 704 Bytes

Versions: 3

Compression:

Stored size: 704 Bytes

Contents

require 'test_helper'
module Adminpanel
  class GalleryzableTest < ActiveSupport::TestCase

    def test_sortable_funcionallity
      gallery = Adminpanel::Gallery.first
      assert_equal 1, gallery.position

      gallery.move_to_better_position
      assert_equal 1, gallery.position

      gallery.move_to_worst_position
      assert_equal 2, gallery.position

      assert_not_equal Adminpanel::Gallery.first, gallery

      Adminpanel::Gallery.find_by_position(3).move_to_better_position
      assert_equal Adminpanel::Gallery.last, gallery

      gallery.reload
      assert_equal 3, gallery.position

      gallery.move_to_worst_position
      assert_equal 3, gallery.position
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
adminpanel-2.4.3 test/models/adminpanel/galleryzable_test.rb
adminpanel-2.4.2 test/models/adminpanel/galleryzable_test.rb
adminpanel-2.4.1 test/models/adminpanel/galleryzable_test.rb