Sha256: 9137757e6c0464ef73cb6065be44e7649395007195fedd51f06d3d05ca3ffec4

Contents?: true

Size: 1.14 KB

Versions: 34

Compression:

Stored size: 1.14 KB

Contents

require 'test_helper'

module Workarea
  class SavePublishingTest < TestCase
    def test_perform_with_now
      product = create_product(active: false)

      assert(SavePublishing.new(product, activate: 'now').perform)
      assert(product.active?)
    end

    def test_perform_with_never
      product = create_product(active: false)

      assert(SavePublishing.new(product, activate: 'never').perform)
      refute(product.active?)
    end

    def test_perform_with_new_release
      product = create_product(active: false)

      publishing = SavePublishing.new(
        product,
        activate: 'new_release',
        release: { name: 'Foo' }
      )

      assert(publishing.perform)
      refute(product.active?)

      release = Release.first
      assert_equal('Foo', release.name)
      release.as_current { assert(product.reload.active?) }
    end

    def test_perform_with_existing_release
      product = create_product(active: false)
      release = create_release

      assert(SavePublishing.new(product, activate: release.id).perform)
      refute(product.active?)

      release.as_current { assert(product.reload.active?) }
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
workarea-core-3.4.25 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.24 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.23 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.22 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.21 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.20 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.19 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.18 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.17 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.16 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.15 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.14 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.13 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.12 test/services/workarea/save_publishing_test.rb