Sha256: 8a0de5a0873fea43a3cf1e5e3f22033165c5097c404f3a521f59aaf244526788

Contents?: true

Size: 822 Bytes

Versions: 62

Compression:

Stored size: 822 Bytes

Contents

require 'test_helper'

module Workarea
  module Navigation
    class SortNavigationMenusByOrdersTest < TestCase
      def test_sorting_by_sales
        menu_one = create_menu(position: 1)
        menu_two = create_menu(position: 2)
        menu_three = create_menu(position: 3)
        menu_four = create_menu(position: 4)

        Metrics::MenuByDay.inc(key: { menu_id: menu_one.id }, orders: 1)
        Metrics::MenuByDay.inc(key: { menu_id: menu_two.id }, orders: 2)
        Metrics::MenuByDay.inc(key: { menu_id: menu_three.id }, orders: 3)

        SortNavigationMenusByOrders.perform

        assert_equal(0, menu_three.reload.position)
        assert_equal(1, menu_two.reload.position)
        assert_equal(2, menu_one.reload.position)
        assert(menu_four.reload.position.present?)
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.5.27 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.5.26 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.4.45 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.5.25 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.5.23 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.4.44 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.5.22 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.4.43 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.5.21 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.4.42 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.5.20 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.4.41 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.5.19 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.4.40 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.5.18 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.4.39 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.5.17 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.4.38 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.5.16 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.4.37 test/services/workarea/sort_navigation_menus_by_orders_test.rb