Sha256: 388c3596e11faa734c827474d9e1f2f1d040511f784411ced63da671cda2d50f

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

require 'test_helper'

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

      def test_create
        post admin.catalog_swatches_path,
          params: { swatch: { name: 'Red', hex: '000000' } }

        assert_equal(1, Catalog::Swatch.count)
        swatch = Catalog::Swatch.find('red')
        assert_equal('Red', swatch.name)
        assert_equal('#000000', swatch.hex)
      end

      def test_update
        swatch = create_swatch(name: 'Red', hex: '000000')

        patch admin.catalog_swatch_path(swatch),
          params: { swatch: { name: 'Redder', hex: '111111' } }

        assert_equal(1, Catalog::Swatch.count)
        swatch = Catalog::Swatch.find('red')
        assert_equal('Redder', swatch.name)
        assert_equal('#111111', swatch.hex)
      end

      def test_destroy
        swatch = create_swatch(name: 'Red', hex: '000000')
        delete admin.catalog_swatch_path(swatch)
        assert_equal(0, Catalog::Swatch.count)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-swatches-1.0.6 test/integration/workarea/admin/swatches_integration_test.rb
workarea-swatches-1.0.5 test/integration/workarea/admin/swatches_integration_test.rb