Sha256: 1df49f0e5895733aeed696d6bd26c7e433384c768f077d130cb9a52b6707e657
Contents?: true
Size: 1.85 KB
Versions: 57
Compression:
Stored size: 1.85 KB
Contents
module ForestLiana class HasManyGetterTest < ActiveSupport::TestCase collectionOwner = ForestLiana::Model::Collection.new({ name: 'Owner', fields: [] }) collectionTree = ForestLiana::Model::Collection.new({ name: 'Tree', fields: [] }) ForestLiana.apimap << collectionOwner ForestLiana.apimap << collectionTree ForestLiana.models << Owner ForestLiana.models << Tree test 'HasMany Getter page 1 size 15' do association = Owner.reflect_on_association(:trees) getter = HasManyGetter.new(Owner, association, { id: 1, association_name: 'trees', page: { size: 15, number: 1 }, timezone: 'America/Nome' }) getter.perform records = getter.records count = getter.count assert records.count == 3 assert count = 3 assert records.first.id == 7 end test 'HasMany Getter with sort parameter' do association = Owner.reflect_on_association(:trees) getter = HasManyGetter.new(Owner, association, { id: 1, association_name: 'trees', sort: '-id', page: { size: 15, number: 1 }, timezone: 'America/Nome' }) getter.perform records = getter.records count = getter.count assert records.count == 3 assert count = 3 assert records.first.id == 8 end test 'HasMany Getter with search parameter' do association = Owner.reflect_on_association(:trees) getter = HasManyGetter.new(Owner, association, { id: 1, association_name: 'trees', search: 'Fir', page: { size: 15, number: 1 }, timezone: 'America/Nome' }) getter.perform records = getter.records count = getter.count assert records.count == 1 assert count = 1 assert records.first.id == 8 end end end
Version data entries
57 entries across 57 versions & 1 rubygems