Sha256: 1d92c9f67198d81cf907683c7953200537deec62ffac81eee887ee5783c87f9b
Contents?: true
Size: 1.43 KB
Versions: 2
Compression:
Stored size: 1.43 KB
Contents
RSpec.describe SteamStats::User do let (:user) { user = SteamStats::User.new 'pewdie' } before do Dir.chdir(File.dirname(__FILE__)) user_response_file = File.new('data/user.html') stub_request(:any, 'http://steamcommunity.com/id/pewdie'). to_return(body: user_response_file.read, status: 200) games_response_file = File.new('data/games.html') stub_request(:any, 'http://steamcommunity.com/id/pewdie/games/?tab=all'). to_return(body: games_response_file.read, status: 200) end it 'gets user name' do expect(user.name).to eq 'Poods' end it 'gets user real name' do expect(user.real_name).to eq 'Felix Kjellberg' end it 'gets user avatar' do expect(user.avatar).to eq 'http://cdn.akamai.steamstatic.com/steamcommunity/public/images/avatars/b9/b9a781a894d319c1a1331a35fc17adf9b02fee76_full.jpg' end it 'gets user country' do expect(user.country).to eq 'SE' end it 'gets user level' do expect(user.level).to eq 12 end it 'checks if user online' do expect(user.is_online?).to be false end it 'gets games' do expect(user.games).to include({ name: 'Call of Duty: Modern Warfare 2 - Multiplayer', played_hours: 914 }, { name: 'VVVVVV', played_hours: 0.1 }) end context 'not played game' do it 'returns 0 played_hours' do expect(user.games).to include({ name: 'LIMBO', played_hours: 0 }) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
steam_stats-1.0.1 | spec/user_spec.rb |
steam_stats-0.0.1 | spec/user_spec.rb |