Sha256: 6f56788152f408c0fe97f9f2a6ae1b97ea3c2fd534e586ef7d079635fb5a4be5

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

describe 'Career' do
  before do
    VCR.use_cassette('career_profile') do
      @my_profile = Covetous::Profile::Career.new 'corroded-6950'
    end
  end

  after do
    VCR.eject_cassette
  end

  describe 'when given a battle tag name and id' do
    it 'should have the correct url' do
      @my_profile.url.must_equal 'http://us.battle.net/api/d3/profile/corroded-6950/'
    end
  end

  describe 'when getting a profile' do
    it 'should have all the hero names associated with that profile' do
      @my_profile.hero_names.must_equal ['corrodee', 'corrodeath', 'corrodea', 'corrodead', 'corroder']
    end

    it 'should have the top level keys available as methods' do
      top_level_keys = %w{heroes last_hero_played artisans hardcore_artisans kills time_played fallen_heroes battle_tag progression hardcore_progression}

      top_level_keys.each do |tl_key|
        @my_profile.send(tl_key).must_equal @my_profile.response[tl_key.camelize(:lower)]
      end
    end

    it "should throw an error when trying to call a top level key that doesn't exist" do
      lambda { @my_profile.foo_attribute }.must_raise NoMethodError
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
covetous-0.0.1 spec/covetous/profile/career_spec.rb