Sha256: 63929a0749f4fbd9c8d61835d8781a50c5928c8e3f27c0174f17ca49c4a1841d

Contents?: true

Size: 917 Bytes

Versions: 3

Compression:

Stored size: 917 Bytes

Contents

require 'test_helper'

module Workarea
  module Storefront
    class ContentSearchResultsTest < TestCase
      setup :reset_index

      def reset_index
        Search::Storefront.reset_indexes!
      end

      class FooSearchViewModel < ApplicationViewModel
        include ContentSearchResults
      end

      def test_multiple_result_types
        response = Search::StorefrontSearch::Response.new
        view_model = FooSearchViewModel.new(response)

        response.expects(:total).returns(0)
        refute(view_model.multiple_result_types?)

        response.expects(:total).returns(1)
        refute(view_model.multiple_result_types?)

        response.expects(:total).returns(0)
        refute(view_model.multiple_result_types?)

        response.expects(:total).returns(1)
        response.expects(:content_total).returns(1)
        assert(view_model.multiple_result_types?)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
workarea-content_search-1.1.0 test/view_models/workarea/storefront/content_search_results_test.rb
workarea-content_search-1.0.9 test/view_models/workarea/storefront/content_search_results_test.rb
workarea-content_search-1.0.8 test/view_models/workarea/storefront/content_search_results_test.rb