Sha256: 1215e6e7a9688160c446facfc5a1deea749f80db843d7a7d6d20dae44b4be031

Contents?: true

Size: 1.23 KB

Versions: 28

Compression:

Stored size: 1.23 KB

Contents

require 'test_helper'

module Workarea
  module Admin
    class ReleaseViewModelTest < TestCase
      def test_calendar_on_returns_the_rescheduled_date
        release = create_release

        release.published_at = Date.current - 1.month
        release.publish_at = Date.current + 1.month
        view_model = ReleaseViewModel.wrap(release)
        assert_equal(Date.current + 1.month, view_model.calendar_on)

        release.publish_at = nil
        view_model = ReleaseViewModel.wrap(release)
        assert_equal(Date.current - 1.month, view_model.calendar_on)
      end

      def test_nil_changesets_are_excluded_from_changesets_with_releasable
        release = create_release
        pricing_sku = create_pricing_sku(prices: [{ regular: 3, sale: 1, min_quantity: 1 }])
        releasable = pricing_sku.prices.first
        releasable.changesets.create!(
          release: release,
          document_path: releasable.document_path
        )

        view_model = ReleaseViewModel.new(release)
        assert_equal(view_model.changesets_with_releasable.length, 1)

        pricing_sku.prices.first.delete
        view_model = ReleaseViewModel.new(release)
        assert_empty(view_model.changesets_with_releasable)
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
workarea-admin-3.5.27 test/view_models/workarea/admin/release_view_model_test.rb
workarea-admin-3.5.26 test/view_models/workarea/admin/release_view_model_test.rb
workarea-admin-3.5.25 test/view_models/workarea/admin/release_view_model_test.rb
workarea-admin-3.5.23 test/view_models/workarea/admin/release_view_model_test.rb
workarea-admin-3.5.22 test/view_models/workarea/admin/release_view_model_test.rb
workarea-admin-3.5.21 test/view_models/workarea/admin/release_view_model_test.rb
workarea-admin-3.5.20 test/view_models/workarea/admin/release_view_model_test.rb
workarea-admin-3.5.19 test/view_models/workarea/admin/release_view_model_test.rb
workarea-admin-3.5.18 test/view_models/workarea/admin/release_view_model_test.rb
workarea-admin-3.5.17 test/view_models/workarea/admin/release_view_model_test.rb
workarea-admin-3.5.16 test/view_models/workarea/admin/release_view_model_test.rb
workarea-admin-3.5.15 test/view_models/workarea/admin/release_view_model_test.rb
workarea-admin-3.5.14 test/view_models/workarea/admin/release_view_model_test.rb
workarea-admin-3.5.13 test/view_models/workarea/admin/release_view_model_test.rb
workarea-admin-3.5.12 test/view_models/workarea/admin/release_view_model_test.rb
workarea-admin-3.5.11 test/view_models/workarea/admin/release_view_model_test.rb
workarea-admin-3.5.10 test/view_models/workarea/admin/release_view_model_test.rb
workarea-admin-3.5.9 test/view_models/workarea/admin/release_view_model_test.rb
workarea-admin-3.5.8 test/view_models/workarea/admin/release_view_model_test.rb
workarea-admin-3.5.7 test/view_models/workarea/admin/release_view_model_test.rb