Sha256: f69f69bf281cc02b447397786571c9576dc253011a50777821f7c7cd40e6a351
Contents?: true
Size: 1.4 KB
Versions: 3
Compression:
Stored size: 1.4 KB
Contents
require "spec_helper" describe Bnet::Starcraft2::Profile do describe ".from_api" do let(:attrs){ { "id" => 1, "realm" => 2, "displayName" => "Testname", "clanName" => "Jade Falcon", "clanTag" => "CJF" } } subject{ described_class.from_api(attrs)} it "is initialized" do expect(subject).to be_a_kind_of(described_class) expect(subject.display_name).to eq("Testname") end end describe ".find" do subject { described_class.find(attrs) } context "Specified user exists for the server", vcr: {cassette_name: 'sc2_profile_found'} do let (:attrs) { {region: 'us', profile_id: 2143215, name: 'PlayerOne'} } it "returns an instance" do expect(subject.display_name).to eq("PlayerOne") end it "sets the achievement point details" do expect(subject.achievement_points).to eq(550) end it "sets the level information" do expect(subject.swarm_level).to eq(2) expect(subject.terran_level).to eq(0) expect(subject.protoss_level).to eq(2) expect(subject.zerg_level).to eq(0) end end context "specified user does not exist on the server", {vcr: {cassette_name: "sc2_profile_not_found" }} do let (:attrs) { {region: 'us', profile_id: 2143215, name: 'PlayeZero'} } it {is_expected.to be_nil} end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bnet-0.0.3 | spec/bnet/starcraft2/profile_spec.rb |
bnet-0.0.2 | spec/bnet/starcraft2/profile_spec.rb |
bnet-0.0.1 | spec/bnet/starcraft2/profile_spec.rb |