spec/bnet/starcraft2/profile_spec.rb in bnet-0.0.4 vs spec/bnet/starcraft2/profile_spec.rb in bnet-0.0.5

- old
+ new

@@ -68,13 +68,12 @@ end describe '#matches' do context 'Naniwa user is found', vcr: {cassette_name: 'SC2 Naniwa profile found' } do subject { profile.matches } - # subject { binding.pry } let(:profile) { - a = Bnet::Starcraft2::Profile.find(profile_id: 2210662, name: 'NaNiwa', region: 'eu') + Bnet::Starcraft2::Profile.find(profile_id: 2210662, name: 'NaNiwa', region: 'eu') } it "returns a collection of matches for a given profile" do expect(subject).to_not be_empty expect(subject).to include( @@ -84,10 +83,35 @@ ) end end end - describe '#ladders' do - subject {profile.ladders} - it "returns the ladder statistics for the profile" + describe '#current_ladder_season' do + subject { profile.current_ladder_season } + context "Jabito's ladder records user are found", vcr: {cassette_name: "SC2 Jabito's Ladder Records" } do + let(:profile) do + Bnet::Starcraft2::Profile.find(profile_id: 2144359, name: 'JaBiTo', region: 'us') + end + + it "returns the current ladders statistics for the profile" do + expect(subject).to_not be_empty + expect(subject).to include( an_object_having_attributes(ladder_name: 'Arbiter Epsilon')) + expect(subject[0].characters[0]['displayName']).to eq('JaBiTo') + end + end + end + + describe "#previous_ladder_season" do + subject { profile.previous_ladder_season } + context "Jabito's ladder records user are found", vcr: {cassette_name: "SC2 Jabito's Ladder Records" } do + let(:profile) do + Bnet::Starcraft2::Profile.find(profile_id: 2144359, name: 'JaBiTo', region: 'us') + end + + it "returns the previous ladder statisttics for the profile" do + expect(subject).to have(7).items + expect(subject).to include( an_object_having_attributes(ladder_name: 'Thor Oscar')) + expect(subject[0].characters[0]['displayName']).to eq('JaBiTo') + end + end end end