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.15 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.4.36 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.5.14 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.4.35 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.5.13 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.4.34 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.5.12 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.4.33 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.5.11 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.5.10 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.4.32 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.5.9 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.4.31 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.5.8 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.4.30 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.5.7 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.4.29 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.5.6 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.4.28 test/services/workarea/sort_navigation_menus_by_orders_test.rb
workarea-core-3.5.5 test/services/workarea/sort_navigation_menus_by_orders_test.rb