Sha256: 2090458c2cdf9c7f162f71973a90f4dae9cf7caf7a1620645499d678c9efed9b

Contents?: true

Size: 899 Bytes

Versions: 6

Compression:

Stored size: 899 Bytes

Contents

require 'spec_helper'

describe ActiveRemote::PrimaryKey do
  let(:tag) { Tag.new(:id => '1234', :guid => 'TAG-123', :user_guid => 'USR-123') }

  after { Tag.instance_variable_set :@primary_key, nil }

  describe ".default_primary_key" do
    it 'returns array of :guid' do
      Tag.default_primary_key.should eq(:guid)
    end
  end

  describe "primary_key" do
    context "when no arguments are passed" do
      it "returns default primary key" do
        Tag.primary_key.should eq(:guid)
      end
    end

    context "when arguments are passed" do
      let(:specified_primary_key) { :name }

      it "returns the given primary key" do
        Tag.primary_key(specified_primary_key).should eq(specified_primary_key)
      end
    end
  end

  describe "#primary_key" do
    it "returns the primary key for the class" do
      Tag.new.primary_key.should eq Tag.primary_key
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
active_remote-2.1.1 spec/lib/active_remote/primary_key_spec.rb
active_remote-2.1.0 spec/lib/active_remote/primary_key_spec.rb
active_remote-2.1.0.rc2 spec/lib/active_remote/primary_key_spec.rb
active_remote-2.1.0.rc1 spec/lib/active_remote/primary_key_spec.rb
active_remote-2.1.0.beta2 spec/lib/active_remote/primary_key_spec.rb
active_remote-2.1.0.beta1 spec/lib/active_remote/primary_key_spec.rb