Sha256: 09b5f2169c39617edc5f1c7c57fa69518e32fe09511aeab02c94d03461747169
Contents?: true
Size: 811 Bytes
Versions: 7
Compression:
Stored size: 811 Bytes
Contents
require 'spec_helper' describe Outpost do describe "::obj_by_key" do context "no match" do it "returns nil" do Outpost.obj_by_key("nomatch").should eq nil end it "accepts nil argument" do Outpost.obj_by_key(nil).should eq nil end end context "match" do it "is nil if no record exists" do Outpost.obj_by_key("blog_entry-9999999").should eq nil end it "finds and returns the record if everything matches" do post = create :post Outpost.obj_by_key(post.obj_key).should eq post end end end #--------------- describe "::obj_by_key!" do it "raises an error if no object is found" do -> { Outpost.obj_by_key!("something") }.should raise_error ActiveRecord::RecordNotFound end end end
Version data entries
7 entries across 7 versions & 1 rubygems