Sha256: 5565a150c7bd9b5a161c051bcc7e018852bca5116bf94c5f9648aaede632f8be

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 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
      getachievements
      getfriends
      getgodranks
      getplayer
      getmatchhistory
      getsearchteams
    ).each do |method|
      WebMock.stub_request(:get, /#{method}/).to_return(
        body: response_body(method),
        headers: { content_type: 'application/json' },
        status: 200
      )
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
smite_ruby-1.4.5 spec/spec_helper.rb