Sha256: 9d57bcf37cab234c29576fb62e34177a1050e378477a35569e33938f48da6a95
Contents?: true
Size: 594 Bytes
Versions: 29
Compression:
Stored size: 594 Bytes
Contents
require 'spec_helper' describe NinjaModel::Identity do class IdentityModel < NinjaModel::Base attribute :primary, :integer, :primary_key => true end before { @obj = IdentityModel.new @obj.primary = 123 @obj } subject { @obj } context 'when persisted' do before { @obj.stubs(:persisted?).returns(true) } its(:to_param) { should eql('123') } its(:to_key) { should eql([123]) } end context 'when not persisted' do before { @obj.stubs(:persisted?).returns(false) } its(:to_param) { should be_nil } its(:to_key) { should be_nil } end end
Version data entries
29 entries across 29 versions & 1 rubygems