Sha256: d9e2da9ba77d47804baf911954f0dac5a8a38526451065e241685523ec084b21

Contents?: true

Size: 1.33 KB

Versions: 28

Compression:

Stored size: 1.33 KB

Contents

require 'test_helper'

module Workarea
  module Search
    class AdminReleasesTest < IntegrationTest
      setup :create_releases

      def create_releases
        @scheduled = create_release(name: 'Scheduled Release', publish_at: 1.week.from_now)
        @unscheduled = create_release(name: 'Unscheduled Release', created_at: Time.zone.local(2016, 6, 6))
        @published = create_release(name: 'Published Release', published_at: 1.week.ago)
      end

      def test_filter
        search = AdminReleases.new(publishing: 'scheduled')
        assert_equal(1, search.total)
        assert_includes(search.results, @scheduled)

        search = AdminReleases.new(publishing: 'unscheduled')
        assert_equal(1, search.total)
        assert_includes(search.results, @unscheduled)

        search = AdminReleases.new(publishing: 'published')
        assert_equal(1, search.total)
        assert_includes(search.results, @published)
      end

      def test_sort
        search = AdminReleases.new(sort: 'published_date')
        assert_equal(@published, search.results.first)
      end

      def test_filter_by_date
        search = AdminReleases.new(
          created_at_greater_than: Time.zone.local(2016, 6, 6),
          created_at_less_than: Time.zone.local(2016, 6, 6)
        )
        assert_equal(1, search.total)
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

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