Sha256: 8ac50d50a175809265bcdd780e402a51f573a0d84fc0f5501d0b8449b1e3f87c

Contents?: true

Size: 1.9 KB

Versions: 5

Compression:

Stored size: 1.9 KB

Contents

require 'spec_helper'

describe Rhapsody::ClientsController do
  it 'has HOST_URL' do
    host_url = Rhapsody::HOST_URL
    expect(host_url).to eql('https://api.rhapsody.com')
  end

  it 'has attributes' do
    options = AuthenticationHelper.post_hash
    client_controller = Rhapsody::ClientsController.new(options)

    expect(client_controller).to respond_to(:api_key)
    expect(client_controller).to respond_to(:api_secret)
    expect(client_controller).to respond_to(:auth_code)
    expect(client_controller).to respond_to(:redirect_url)
    expect(client_controller).to respond_to(:raw_reponse)
    expect(client_controller).to respond_to(:json_response)
    expect(client_controller).to respond_to(:response_status)
    expect(client_controller).to respond_to(:access_token)
    expect(client_controller).to respond_to(:refresh_token)
    expect(client_controller).to respond_to(:expires_in)
  end

  it '#me_account' do
    options = AuthenticationHelper.post_hash
    client_controller = Rhapsody::ClientsController.new(options)
    client_controller.access_token = AuthenticationHelper.get_access_token

    member = client_controller.me_account

    member_attributes = [
      :cobrand,
      :cocat,
      :email,
      :logon,
      :firstName,
      :id,
      :lastName,
      :locale,
      :country,
      :isPublic,
      :billingPartnerCode,
      :catalog,
      :createDate,
      :isSuspended,
      :tierCode,
      :tierName,
      :productCode,
      :productName,
      :expirationDate,
      :trialLengthDays,
      :isTrial,
      :state,
      :canStreamOnWeb,
      :canStreamOnMobile,
      :canStreamOnHomeDevice,
      :canStreamOnPC,
      :canUpgradeStreams,
      :maxStreamCount,
      :isPlayBasedTier,
      :isMonthlyPlayBasedTier,
      :isOneTimePlayBasedTier,
      :totalPlays,
      :playsRemaining
    ]
    member_attributes.each do |attr|
      expect(member).to respond_to(attr)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rhapsody-0.0.8 spec/rhapsody/controllers/clients_controller_spec.rb
rhapsody-0.0.8.beta3 spec/rhapsody/controllers/clients_controller_spec.rb
rhapsody-0.0.8.beta2 spec/rhapsody/controllers/clients_controller_spec.rb
rhapsody-0.0.8.beta1 spec/rhapsody/controllers/clients_controller_spec.rb
rhapsody-0.0.7 spec/rhapsody/controllers/clients_controller_spec.rb