Sha256: e0b0d7ccd3555941aa2cd929e57ae8695dcec4a2bcab94bed06e570ae8f5728b

Contents?: true

Size: 1.25 KB

Versions: 13

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

describe Legato::Management::Account do
  context "The Account class" do
    def self.subject_class_name
      "accounts"
    end

    it_behaves_like "a management finder"

    it 'creates a new account instance from a hash of attributes' do
      user = stub(:api_key => nil)
      account = Legato::Management::Account.new({"id" => 12345, "name" => "Account 1"}, user)
      account.user.should == user
      account.id.should == 12345
      account.name.should == "Account 1"
    end
  end

  context "An Account instance" do
    let(:account) {Legato::Management::Account.new({"id" => 123456}, stub)}

    it 'builds the path for the account from the id' do
      account.path.should == '/accounts/123456'
    end

    it 'has web properties beneath it' do
      Legato::Management::WebProperty.stubs(:for_account).returns('web_properties')
      account.web_properties.should == 'web_properties'
      Legato::Management::WebProperty.should have_received(:for_account).with(account)
    end

    it 'has profiles beneath it' do
      Legato::Management::Profile.stubs(:for_account).returns('profiles')
      account.profiles.should == 'profiles'
      Legato::Management::Profile.should have_received(:for_account).with(account)
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
legato-0.3.3 spec/lib/legato/management/account_spec.rb
legato-0.3.2 spec/lib/legato/management/account_spec.rb
legato-0.3.1 spec/lib/legato/management/account_spec.rb
legato-0.3.0 spec/lib/legato/management/account_spec.rb
legato-0.2.0 spec/lib/legato/management/account_spec.rb
legato-0.1.0 spec/lib/legato/management/account_spec.rb
legato-0.0.10 spec/lib/legato/management/account_spec.rb
legato-0.0.9 spec/lib/legato/management/account_spec.rb
legato-0.0.8 spec/lib/legato/management/account_spec.rb
legato-0.0.7 spec/lib/legato/management/account_spec.rb
legato-0.0.6 spec/lib/legato/management/account_spec.rb
legato-0.0.5 spec/lib/legato/management/account_spec.rb
legato-0.0.4 spec/lib/legato/management/account_spec.rb