Sha256: 8b63e197521bd10946ae15f8c864f0d15b09a18a09e007f0ea0bf9a07ce6d342

Contents?: true

Size: 1.99 KB

Versions: 62

Compression:

Stored size: 1.99 KB

Contents

require 'test_helper'

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

      def test_can_create_a_help_article
        post admin.help_index_path,
          params: {
            help_article: {
              name: 'Test Article',
              thumbnail: product_image_file,
              category: 'FAQs',
              matching_url: '/admin',
              summary: 'Summary',
              body: 'Nice body.'
            }
          }

        assert_equal(1, Help::Article.count)

        help_article = Help::Article.first
        assert_equal('Test Article', help_article.name)
        assert(help_article.thumbnail.present?)
        assert_equal('FAQs', help_article.category)
        assert_equal('/admin', help_article.matching_url)
        assert_equal('Summary', help_article.summary)
        assert_equal('Nice body.', help_article.body)
      end

      def test_can_update_a_help_article
        help_article = create_help_article(
          name: 'Test Article',
          category: 'FAQs',
          body: 'Nice body.'
        )

        patch admin.help_path(help_article),
          params: {
            help_article: {
              name: 'Foo Article',
              category: 'Howto',
              matching_url: '/admin',
              summary: 'Summary',
              body: 'Nicer body.'
            }
          }

        help_article.reload
        assert_equal('Foo Article', help_article.name)
        assert_equal('Howto', help_article.category)
        assert_equal('/admin', help_article.matching_url)
        assert_equal('Summary', help_article.summary)
        assert_equal('Nicer body.', help_article.body)
      end

      def test_can_destroy_a_help_article
        help_article = create_help_article(
          name: 'Test Article',
          category: 'FAQs',
          body: 'Nice body.'
        )

        delete admin.help_path(help_article)
        assert(Help::Article.empty?)
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-admin-3.4.13 test/integration/workarea/admin/help_articles_integration_test.rb
workarea-admin-3.4.12 test/integration/workarea/admin/help_articles_integration_test.rb