Sha256: d4fcb8ee324f906d2ac6b3b7851e8ce12d9cbee476be74e54bfcbc0be97180cb
Contents?: true
Size: 1.42 KB
Versions: 23
Compression:
Stored size: 1.42 KB
Contents
require File.dirname(__FILE__) + '/../liquid_helper' include LiquidHelperMethods module RedmineCrm class ArraysFilterTest < ActiveSupport::TestCase def setup @liquid_render = LiquidRender.new @array = '6,7,8,9,1,2,3,4,5' end def test_first_filter assert_match '1', @liquid_render.render("{{ '#{@array}' | split: ',' | first: 5 | last }}") end def test_sort_filter assert_match '123456789', @liquid_render.render("{{ '#{@array}' | split: ',' | sort }}") end def test_where_filter assert_match '{"name"=>"two", "value"=>5}', @liquid_render.render("{{ objects_arr | where: 'name', 'two' }}") assert_match '{"name"=>"one", "value"=>10}', @liquid_render.render("{{ objects_arr | where: 'value', 6, '>' }}") assert_match '{"name"=>"one", "value"=>10}', @liquid_render.render("{{ objects_arr | where: 'name', 'on', 'match' }}") assert_match '3', @liquid_render.render("{{ objects_arr | where: 'value', '', 'any' | size }}") assert_match '1', @liquid_render.render("{{ objects_arr | where: 'value', '', 'none' | size }}") assert_match '2', @liquid_render.render("{{ issues.all | where: 'author.name', 'Jonathan', '==' | size }}") assert_match '1', @liquid_render.render("{{ issues.all | where: 'author.language', 'CH', '==' | size }}") assert_match '0', @liquid_render.render("{{ issues.all | where: 'author.name', '', 'none' | size }}") end end end
Version data entries
23 entries across 23 versions & 1 rubygems