spec/collection_spec.rb in cistern-2.2.7 vs spec/collection_spec.rb in cistern-2.3.0

- old
+ new

@@ -1,9 +1,10 @@ require 'spec_helper' describe 'Cistern::Collection' do - class SampleService < Cistern::Service + class SampleService + include Cistern::Client end class Drug < SampleService::Model identity :id attribute :name @@ -16,11 +17,11 @@ load([{ id: 1 }, { id: 3, name: 'tom' }, { id: 2 }]) end end class Tacs < SampleService::Collection - service_method :toes + cistern_method :toes end it 'should generate a default collection method' do expect(SampleService.new.drugs).not_to be_empty end @@ -61,7 +62,22 @@ expect(Drugs.new.slice(0, 2)).to eq([Drug.new(id: 1), Drug.new(id: 3, name: 'tom')]) end it 'should ==' do Drugs.new.all == Drugs.new.all + end + + describe 'deprecation', :deprecated do + class DeprecatedCollectionService + include Cistern::Client + end + + it 'responds to #service' do + class DeprecationCollection < DeprecatedCollectionService::Collection + service_method :deprecator + end + + sample = DeprecatedCollectionService.new.deprecator + expect(sample.service).to eq(sample.cistern) + end end end