Sha256: 6bbcb8eeccf86a0f36983343c13ca5315028488b9cbf123e543aba198171ee9d

Contents?: true

Size: 1.66 KB

Versions: 62

Compression:

Stored size: 1.66 KB

Contents

require 'test_helper'

module Workarea
  module Admin
    class SearchCustomizationsIntegrationTest < Workarea::IntegrationTest
      include Admin::IntegrationTest

      def test_autocomplete
        create_search_customization(id: 'test', query: 'test')
        create_search_customization(id: 'test_foo', query: 'test foo')

        get admin.search_customizations_path(format: 'json', q: 'tes'), xhr: true

        results = JSON.parse(response.body)['results']
        assert_equal(2, results.length)
      end

      def test_creating
        post admin.search_customizations_path, params: { q: 'Test' }

        assert_equal(1, Search::Customization.count)
        customization = Search::Customization.first

        assert_equal('test', customization.id)
        assert_equal('test', customization.query)
      end

      def test_invalid_creation
        assert_nothing_raised do
          post admin.search_customizations_path, params: { q: '' }
        end

        assert_redirected_to(admin.root_path)
      end

      def test_updating
        customization = create_search_customization

        patch admin.search_customization_path(customization),
          params: {
            customization: {
              rewrite: 'bar',
              redirect: 'http://www.foo.com'
            }
          }

        customization.reload

        assert_equal('bar', customization.rewrite)
        assert_equal('http://www.foo.com', customization.redirect)
      end

      def test_deleting
        customization = create_search_customization
        delete admin.search_customization_path(customization)
        assert_equal(0, Search::Customization.count)
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-admin-3.5.15 test/integration/workarea/admin/search_customizations_integration_test.rb
workarea-admin-3.4.36 test/integration/workarea/admin/search_customizations_integration_test.rb
workarea-admin-3.5.14 test/integration/workarea/admin/search_customizations_integration_test.rb
workarea-admin-3.4.35 test/integration/workarea/admin/search_customizations_integration_test.rb
workarea-admin-3.5.13 test/integration/workarea/admin/search_customizations_integration_test.rb
workarea-admin-3.4.34 test/integration/workarea/admin/search_customizations_integration_test.rb
workarea-admin-3.5.12 test/integration/workarea/admin/search_customizations_integration_test.rb
workarea-admin-3.4.33 test/integration/workarea/admin/search_customizations_integration_test.rb
workarea-admin-3.5.11 test/integration/workarea/admin/search_customizations_integration_test.rb
workarea-admin-3.5.10 test/integration/workarea/admin/search_customizations_integration_test.rb
workarea-admin-3.4.32 test/integration/workarea/admin/search_customizations_integration_test.rb
workarea-admin-3.5.9 test/integration/workarea/admin/search_customizations_integration_test.rb
workarea-admin-3.4.31 test/integration/workarea/admin/search_customizations_integration_test.rb
workarea-admin-3.5.8 test/integration/workarea/admin/search_customizations_integration_test.rb
workarea-admin-3.4.30 test/integration/workarea/admin/search_customizations_integration_test.rb
workarea-admin-3.5.7 test/integration/workarea/admin/search_customizations_integration_test.rb
workarea-admin-3.4.29 test/integration/workarea/admin/search_customizations_integration_test.rb
workarea-admin-3.5.6 test/integration/workarea/admin/search_customizations_integration_test.rb
workarea-admin-3.4.28 test/integration/workarea/admin/search_customizations_integration_test.rb
workarea-admin-3.5.5 test/integration/workarea/admin/search_customizations_integration_test.rb