Sha256: ca0306bdec10d9645ca58759b2fde5d8cacba0849bffe6afc1fc113f6181dd14

Contents?: true

Size: 553 Bytes

Versions: 5

Compression:

Stored size: 553 Bytes

Contents

require 'helper'

describe Toy::Store do
  uses_constants('User')

  describe "#to_key" do
    it "returns [id] if persisted" do
      user = User.create
      user.to_key.should == [user.id]
    end

    it "returns nil if not persisted" do
      User.new.to_key.should be_nil
    end
  end

  describe "#to_param" do
    it "returns key joined by - if to_key present" do
      user = User.create
      user.to_param.should == user.to_key.join('-')
    end

    it "returns nil if to_key nil" do
      User.new.to_param.should be_nil
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
toystore-0.10.4 spec/toy/store_spec.rb
toystore-0.10.3 spec/toy/store_spec.rb
toystore-0.10.2 spec/toy/store_spec.rb
toystore-0.10.1 spec/toy/store_spec.rb
toystore-0.10.0 spec/toy/store_spec.rb