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.4.27 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.5.4 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.4.26 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.5.3 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.4.25 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.5.2 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.4.24 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.5.1 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.4.23 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.4.22 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.5.0 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.4.21 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.5.0.beta.1 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.4.20 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.4.19 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.4.18 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.4.17 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.4.16 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.4.15 test/queries/workarea/search/range_parameter_test.rb
workarea-core-3.4.14 test/queries/workarea/search/range_parameter_test.rb