Sha256: 254f89898c921e1fb30395e2b57a4e0b3552d3da0aaca35dc403301b1d1bd7b5
Contents?: true
Size: 882 Bytes
Versions: 3
Compression:
Stored size: 882 Bytes
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') class Beer def self.human_name(*args) "Beer" end def self.all(*args) [Beer.new, Beer.new] end end class BeerCollection < ActiveCollection::Base end describe ActiveCollection, "(proxying)" do subject { BeerCollection.new } it "responds to array methods" do subject.should respond_to(:map) subject.should respond_to(:slice) end it "loads the collection when sending array methods" do Beer.should_receive(:all).and_return([Beer.new]) subject.send(:slice, 0).should_not be_nil end it "responds to its own instance methods" do subject.should respond_to(:loaded?) subject.should respond_to(:empty?) end it "doesn't load the collection when sending collection methods" do Beer.should_not_receive(:all) subject.send(:loaded?).should be_false end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
active_collection-0.2.6 | spec/proxy_spec.rb |
active_collection-0.2.5 | spec/proxy_spec.rb |
active_collection-0.2.4 | spec/proxy_spec.rb |