Sha256: fcc4c9a67989e851bc3e59960ce6b9c43d48af952960235c09cf55ccff24a023

Contents?: true

Size: 1.04 KB

Versions: 62

Compression:

Stored size: 1.04 KB

Contents

require 'test_helper'

module Workarea
  module Admin
    class HelpSearchViewModelTest < TestCase
      def test_returns_the_recent_articles_in_each_category
        howto = Array.new(3) do
          create_help_article(name: 'Foo', category: 'Howto')
        end

        feature = Array.new(3) do
          create_help_article(name: 'Foo', category: 'Feature')
        end

        popular = Array.new(3) do
          create_help_article(name: 'Foo', category: 'Popular')
        end

        view_model = HelpSearchViewModel.new(Search::HelpSearch.new)
        results = view_model.top_articles_by_category

        assert_equal(howto.reverse, results['Howto'])
        assert_equal(feature.reverse, results['Feature'])
        assert_equal(popular.reverse, results['Popular'])
      end

      def test_does_not_include_empty_categories
        create_help_article(name: 'Foo', category: 'Popular').destroy

        view_model = HelpSearchViewModel.new(Search::HelpSearch.new)
        assert(view_model.top_articles_by_category.empty?)
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

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