Sha256: 713755a5646398ff05f66c76374a9f17c328d424cb82c834c1070391cf236a57

Contents?: true

Size: 980 Bytes

Versions: 62

Compression:

Stored size: 980 Bytes

Contents

require 'test_helper'

module Workarea
  module Search
    class RangeParameterTest < TestCase
      def test_start
        assert_equal('5', RangeParameter.new('5-10').start)
        assert_equal('*', RangeParameter.new('*-10').start)
        assert_equal('5', RangeParameter.new("'\"5-10").start)
      end

      def test_stop
        assert_equal('10', RangeParameter.new('5-10').stop)
        assert_equal('*', RangeParameter.new('5-*').stop)
        assert_equal('10', RangeParameter.new("5-10'\"").stop)
      end

      def test_to_filter
        assert_equal('5', RangeParameter.new('5-10').to_filter[:gte])
        assert_equal('10', RangeParameter.new('5-10').to_filter[:lt])

        assert_nil(RangeParameter.new('*-10').to_filter[:gte])
        assert_equal('10', RangeParameter.new('*-10').to_filter[:lt])

        assert_equal('5', RangeParameter.new('5-*').to_filter[:gte])
        assert_nil(RangeParameter.new('5-*').to_filter[:lt])
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.5.15 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.4.36 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.5.14 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.4.35 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.5.13 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.4.34 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.5.12 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.4.33 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.5.11 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.5.10 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.4.32 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.5.9 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.4.31 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.5.8 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.4.30 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.5.7 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.4.29 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.5.6 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.4.28 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.5.5 test/queries/workarea/search/range_parameter_test.rb