spec/lib/outpost_spec.rb in outpost-cms-0.0.3 vs spec/lib/outpost_spec.rb in outpost-cms-0.0.4
- old
+ new
@@ -4,29 +4,29 @@
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("blogs/entry:9999999").should eq nil
+ 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