Sha256: e76d42327c528f0a0d3ae04fe3653769e0ae4eac95310daddc46eaa8d554a9f8
Contents?: true
Size: 1.21 KB
Versions: 9
Compression:
Stored size: 1.21 KB
Contents
def tests_model tests_model_first tests_collection tests_model_last end def tests_model_first tests(@model.class) do test('#save') do @model.save end if @model.respond_to?(:ready?) @model.wait_for { ready? } end test('#reload') do reloaded = @model.reload @model.attributes == reloaded.attributes end end end def tests_collection tests(@collection.class) do test('collection#all includes persisted models') do @collection.all.map {|model| model.identity}.include?(@model.identity) end tests('collection#get') do test 'should return a matching model if one exists' do get = @collection.get(@model.identity) @model.attributes == get.attributes end test 'should return nil if no matching model exists' do !@collection.get(@non_id) end end test('collection#reload') do @collection.all reloaded = @collection.reload @collection.attributes == reloaded.attributes end end end def tests_model_last tests(@model.class) do test('#destroy') do if @model.respond_to?(:ready?) @model.wait_for{ ready? } end @model.destroy end end end
Version data entries
9 entries across 9 versions & 1 rubygems