Sha256: 245f7212f877aca4303f4ecb4c37d6f4916e2b16e10550915666906f8e1d3754

Contents?: true

Size: 1.29 KB

Versions: 12

Compression:

Stored size: 1.29 KB

Contents

require 'spec_helper'

describe Cradlepoint::Account do

  context 'without an id' do

    let(:account) { Cradlepoint::Account.new }

    before do 
      login
      account.id
    end

    after { logout }

    it 'should lazy load the id' do
      account.id.should == ACCOUNT_ID
    end

    it 'should also assign the response to the data attribute' do
      account.data.should be
    end
  end

  context 'with an id' do

    let(:id) { 123 }
    let(:account) { Cradlepoint::Account.new(id) }

    it 'should return the id' do
      account.id.should == id
    end
  end

  describe '.rel_url' do

    let(:rel_url) { '/accounts' }

    it 'should return the proper rel_url from the factory' do
      Cradlepoint::Account.rel_url.should == rel_url
    end

    it 'should return the proper rel_url' do
      Cradlepoint::Account.new.rel_url.should == rel_url
    end
  end

  describe '.rel_url_with_id' do

    let(:id) { 123 }
    let(:rel_url_with_id) { "/accounts/#{ id }/" }
    let(:account) { Cradlepoint::Account.new(id) }

    it 'should return the proper rel_url_with_id from the factory' do
      Cradlepoint::Account.rel_url_with_id(id).should == rel_url_with_id
    end

    it 'should return the proper rel_url_with_id' do
      account.rel_url_with_id.should == rel_url_with_id
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
cradlepoint-0.2.7.2 spec/account_spec.rb
cradlepoint-0.2.7.1 spec/account_spec.rb
cradlepoint-0.2.7 spec/account_spec.rb
cradlepoint-0.2.6 spec/account_spec.rb
cradlepoint-0.2.5 spec/account_spec.rb
cradlepoint-0.2.4 spec/account_spec.rb
cradlepoint-0.2.3 spec/account_spec.rb
cradlepoint-0.2.2 spec/account_spec.rb
cradlepoint-0.2.1 spec/account_spec.rb
cradlepoint-0.2.0 spec/account_spec.rb
cradlepoint-0.1.2 spec/account_spec.rb
cradlepoint-0.1.1 spec/account_spec.rb