Sha256: 6a78e0e036d6de643e7d34cfcae3be6cb551b9ffeb3237e0f44362451ed6e415

Contents?: true

Size: 1.16 KB

Versions: 34

Compression:

Stored size: 1.16 KB

Contents

require 'test_helper'

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

      setup :set_tax_category

      def set_tax_category
        @tax_category = {
            name: 'Tax Category',
            code: '001'
          }
      end

      def test_creates_a_new_tax_category
        post admin.tax_categories_path,
          params: { category: @tax_category, new_rates: [{ percentage: 0.07 }] }

        assert_equal(1, Tax::Category.count)

        category = Tax::Category.first
        assert_equal('Tax Category', category.name)
        assert_equal('001', category.code)
      end

      def test_updates_a_tax_category
        category = create_tax_category(name: "test tax")
        patch admin.tax_category_path(category),
          params: { category: { name: 'foo bar'} }

        assert_equal(1, Tax::Category.count)
        assert_equal('foo bar', Tax::Category.first.name)
      end

      def test_deletes_a_tax_category
        category = create_tax_category
        delete admin.tax_category_path(category)
        assert_equal(0, Tax::Category.count)
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
workarea-admin-3.4.25 test/integration/workarea/admin/tax_categories_integration_test.rb
workarea-admin-3.4.24 test/integration/workarea/admin/tax_categories_integration_test.rb
workarea-admin-3.4.23 test/integration/workarea/admin/tax_categories_integration_test.rb
workarea-admin-3.4.22 test/integration/workarea/admin/tax_categories_integration_test.rb
workarea-admin-3.4.21 test/integration/workarea/admin/tax_categories_integration_test.rb
workarea-admin-3.4.20 test/integration/workarea/admin/tax_categories_integration_test.rb
workarea-admin-3.4.19 test/integration/workarea/admin/tax_categories_integration_test.rb
workarea-admin-3.4.18 test/integration/workarea/admin/tax_categories_integration_test.rb
workarea-admin-3.4.17 test/integration/workarea/admin/tax_categories_integration_test.rb
workarea-admin-3.4.16 test/integration/workarea/admin/tax_categories_integration_test.rb
workarea-admin-3.4.15 test/integration/workarea/admin/tax_categories_integration_test.rb
workarea-admin-3.4.14 test/integration/workarea/admin/tax_categories_integration_test.rb
workarea-admin-3.4.13 test/integration/workarea/admin/tax_categories_integration_test.rb
workarea-admin-3.4.12 test/integration/workarea/admin/tax_categories_integration_test.rb