Sha256: 7d09ae6619c4a42875e7f2725d84f9b1c24fbd4f76d0c9b8c0714e40e892b6cb
Contents?: true
Size: 1.24 KB
Versions: 5
Compression:
Stored size: 1.24 KB
Contents
require 'simplecov' require 'coveralls' SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter ] SimpleCov.start require 'ivapi' require 'rspec' require 'webmock/rspec' WebMock.disable_net_connect!(allow: 'coveralls.io') RSpec.configure do |config| config.expect_with :rspec do |c| c.syntax = :expect end end def stub_get(url) stub_request(:get, iv_url(url)) end def stub_command(command, options = {}) params = { command: command } params.merge!(options) client = @client || Ivapi.client params.merge!(client.authentication) stub_request(:get, 'https://api.iv.lt/json.php').with(query: params) end def fixture_path File.expand_path('../fixtures', __FILE__) end def fixture(file) File.new(fixture_path + '/' + file) end def json_response(file) { body: fixture(file), headers: { content_type: 'application/json; charset=utf-8' } } end def iv_url(url) if url =~ /^http/ url else "https://api.iv.lt#{url}" end end def iv_command_url(command) if @client && @client.authenticated? iv_url("?nick=#{@client.username}&password=#{@client.password}&command=#{command}") else iv_url("?command=#{command}") end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
ivapi-1.1.4 | spec/spec_helper.rb |
ivapi-1.1.3 | spec/spec_helper.rb |
ivapi-1.1.2 | spec/spec_helper.rb |
ivapi-1.1.1 | spec/spec_helper.rb |
ivapi-1.1.0 | spec/spec_helper.rb |