Sha256: 46ea6b1a217cc4ac2ea1a5b44f90695f3ce8fbb28eb78064b8e081b6db92ada8

Contents?: true

Size: 616 Bytes

Versions: 5

Compression:

Stored size: 616 Bytes

Contents

require 'helper'

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

  subject { User.new }

  it_should_behave_like 'ActiveModel'

  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.13.2 spec/toy/store_spec.rb
toystore-0.13.1 spec/toy/store_spec.rb
toystore-0.13.0 spec/toy/store_spec.rb
toystore-0.12.0 spec/toy/store_spec.rb
toystore-0.11.0 spec/toy/store_spec.rb