Sha256: bd75c75c36748f6967f080103255f62dd90dcbc895e42fbc126324be1e6547d7
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
$:.push File.expand_path("../../lib", __FILE__) require 'cubbyhole' describe Cubbyhole do it "makes constants" do NewConstant.new.foo.should == nil end it "allows you to set attrs on new" do model = NewModel.new(:foo => "bar", :baz => "bang") model.foo.should == "bar" model.baz.should == "bang" end it "allows you to save and fetch objects" do model = NewModel.new(:foo => "bar") model.save fetched = NewModel.get(model.id) fetched.foo.should == "bar" end it "should not persist unsaved objects" do model = NewModel.new(:foo => "bar") NewModel.get(model.id).should be_nil end it "allows you to create saved objects" do model = NewModel.create(:foo => "bar") fetched = NewModel.get(model.id) fetched.foo.should == "bar" end it "allows you to set and retrieve attributes" do model = NewModel.new model.foo.should == nil model.foo = "bar" model.foo.should == "bar" end it "allows you to update_attributes" do model = NewModel.new(:foo => "bar") model.save model.update_attributes(:foo => "baz", :bar => "zot") fetched = NewModel.get(model.id) fetched.foo.should == "baz" fetched.bar.should == "zot" end it "finds all objects" do 3.times { MyModel.create } MyModel.all.size.should == 3 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cubbyhole-0.1.1 | spec/cubbyhole_spec.rb |