Sha256: cc4b33ed7a3feea1d651f555b8b84cba8273a080a37ccf975e660b869058fae5

Contents?: true

Size: 1.71 KB

Versions: 2

Compression:

Stored size: 1.71 KB

Contents

require 'spec_helper'

describe Steam::Apps do
  describe '.get_all' do
    it 'should allow users to look up a list of all apps' do
      Steam::Apps.get_all
        .should_not be_nil
    end

    it 'should allow users to look up a list of all apps' do
      game = Steam::Apps.get_all.first
      game.should have_key 'appid'
      game.should have_key 'name'
    end
  end

  describe '.get_servers' do
    it 'should allow users to look up a list of servers at an ip' do
      Steam::Apps.get_servers(addr: '192.168.1.1')
        .should_not be_nil
    end

    it 'should allow users to look up a list of servers at an ip' do
      Steam::Apps.get_servers(addr: '192.168.1.1')
        .should == []
    end
  end

  describe '.up_to_date' do
    it 'should allow users to look up version info' do
      Steam::Apps.up_to_date(appid: 440, version: 10)
        .should_not be_nil
    end

    it 'should return a false up to date value if the verion is out of date' do
      check = Steam::Apps.up_to_date(appid: 440, version: 10)
      check['up_to_date'].should be_false
      check['version_is_listable'].should be_false
      check.should have_key('required_version')
      check['message'].should == 'Your server is out of date, please upgrade'
    end

    it 'should return a positive up to date value if the version is correct' do
      current = Steam::Apps.up_to_date(appid: 440, version: 10)['required_version']
      check = Steam::Apps.up_to_date(appid: 440, version: current)
      check['up_to_date'].should be_true
      check['version_is_listable'].should be_true
    end

    it 'should capture json errors' do
      lambda { Steam::Apps.up_to_date(appid: nil, version: 'foo') }
        .should raise_error
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
steam-api-1.0.1 spec/steam/apps_spec.rb
steam-api-1.0.0 spec/steam/apps_spec.rb