Sha256: 6bd7f875eed30c6ee10247d89de2bb2ba5eec2e9c072df902fa49effe028ebf9
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 KB
Contents
require 'spec_helper' describe Outpost::Model::Identifier do describe "::content_key" do it "uses the table name if it responds to it" do Person.stub(:table_name) { "people_and_stuff" } Person.content_key.should eq "people/and/stuff" end it "tableizes the classname if no table" do Person.content_key.should eq "people" end end #---------------- describe "::route_key" do it "uses ActiveModel's route_key method" do ActiveModel::Naming.should_receive(:route_key) Person.route_key end end #---------------- describe "::singular_route_key" do it "uses ActiveModel's singular_route_key method" do ActiveModel::Naming.should_receive(:singular_route_key) Person.singular_route_key end end #---------------- describe "#obj_key" do context "for persisted record" do it "uses the class's content_key, the record's ID, and joins by :" do person = Person.create(name: "Bryan") person.id.should_not be_blank person.obj_key.should eq "people:#{person.id}" end end context "for new record" do it "uses new in the key" do person = Person.new(name: "Bryan") person.obj_key.should eq "people:new" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
outpost-cms-0.0.3 | spec/lib/model/identifier_spec.rb |