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.45 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.44 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.43 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.42 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.41 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.40 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.39 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.38 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.37 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.36 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.35 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.34 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.33 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.32 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.31 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.30 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.29 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.28 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.27 test/services/workarea/save_publishing_test.rb
workarea-core-3.4.26 test/services/workarea/save_publishing_test.rb