Sha256: 4a396be1edfa25f44d8c96208cf837642a72833233bc2a3b46ce33e6d550ba08
Contents?: true
Size: 716 Bytes
Versions: 62
Compression:
Stored size: 716 Bytes
Contents
require 'test_helper' module Mongoid class ListFieldTest < Workarea::TestCase class ListDocument include Mongoid::Document field :some_ids, type: Array list_field :some_ids end def test_sets_parses_the_list_and_sets_the_array_values doc = ListDocument.new(some_ids_list: '1,2,3') assert_equal(%w(1 2 3), doc.some_ids) end def test_strips_whitespace_and_blank_values doc = ListDocument.new doc.some_ids_list = ' 1 , 2, ,,3 ' assert_equal(%w(1 2 3), doc.some_ids) end def test_gets_a_list_with_commas_a_single_space doc = ListDocument.new(some_ids: %w(1 2 3)) assert_equal('1, 2, 3', doc.some_ids_list) end end end
Version data entries
62 entries across 62 versions & 1 rubygems