Sha256: 96f3ab30d709785d1a7cdaf3a79fa2d90b0b381d5f8d2ddc7142fb79caf6d620

Contents?: true

Size: 1.24 KB

Versions: 4

Compression:

Stored size: 1.24 KB

Contents

require 'rspec'
require 'webmock'

require_relative File.join(File.dirname(__FILE__), '..', 'lib', 'smite.rb')
require_relative File.join(File.dirname(__FILE__), 'shared_examples', 'smite_object.rb')

def response_file(request)
  "#{File.dirname(__FILE__)}/responses/#{request}.json"
end

def response_body(request)
  File.open(response_file(request)).read
end

RSpec.configure do |config|
  config.before do
    WebMock.disable_net_connect! allow_localhost: true
    %w(
      createsession
      testsession
      getdataused
      getgods
      getitems
      getesportsproleaguedetails
      getgodrecommendeditems
      getmatchplayerdetails
      getmatchidsbyqueue
      getleagueseasons
      getleagueleaderboard
      getmotd
      getplayerstatus
      getqueuestats
      getteamdetails
      getteamplayers
      gettopmatches
      getmatchdetails
      getplayerachievements
      getfriends
      getgodranks
      getplayer
      getmatchhistory
      getsearchteams
    ).each do |method|
      WebMock.stub_request(:get, /smiteapi\.svc\/#{method}json\//).to_return(
        body: response_body(method),
        headers: { content_type: 'application/json' },
        status: 200
      )
    end
    
    Smite::Game.authenticate!(1234, 'ABCD')
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
smite_ruby-1.5.1 spec/spec_helper.rb
smite_ruby-1.5.0 spec/spec_helper.rb
smite_ruby-1.4.9 spec/spec_helper.rb
smite_ruby-1.4.6 spec/spec_helper.rb