Sha256: 240d24f3657679f580e652b27bc691edad7b706e492d0bdd9be2792b21331740

Contents?: true

Size: 1.58 KB

Versions: 15

Compression:

Stored size: 1.58 KB

Contents

require 'simplecov'
require 'coveralls'

SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
  SimpleCov::Formatter::HTMLFormatter,
  Coveralls::SimpleCov::Formatter
]
SimpleCov.start

require 'ticketing_hub'
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 a_delete(url)
  a_request(:delete, ticketinghub_url(url))
end

def a_get(url)
  a_request(:get, ticketinghub_url(url))
end

def a_patch(url)
  a_request(:patch, ticketinghub_url(url))
end

def a_post(url)
  a_request(:post, ticketinghub_url(url))
end

def a_put(url)
  a_request(:put, ticketinghub_url(url))
end

def stub_delete(url)
  stub_request(:delete, ticketinghub_url(url))
end

def stub_get(url)
  stub_request(:get, ticketinghub_url(url))
end

def stub_head(url)
  stub_request(:head, ticketinghub_url(url))
end

def stub_patch(url)
  stub_request(:patch, ticketinghub_url(url))
end

def stub_post(url)
  stub_request(:post, ticketinghub_url(url))
end

def stub_put(url)
  stub_request(:put, ticketinghub_url(url))
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 ticketinghub_url(url)
  if url =~ /^http/
    url
  elsif @client && @client.authenticated?
    "https://#{@client.token}:#{@client.secret}@api.ticketinghub.com#{url}"
  else
    "https://api.ticketinghub.com#{url}"
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ticketinghub-1.1.1 spec/helper.rb
ticketinghub-1.1.0 spec/helper.rb
ticketinghub-1.0.9 spec/helper.rb
ticketinghub-1.0.8 spec/helper.rb
ticketinghub-1.0.7 spec/helper.rb
ticketinghub-1.0.6 spec/helper.rb
ticketinghub-1.0.5 spec/helper.rb
ticketinghub-1.0.4 spec/helper.rb
ticketinghub-1.0.3 spec/helper.rb
ticketinghub-1.0.2 spec/helper.rb
ticketinghub-1.0.1 spec/helper.rb
ticketinghub-1.0.0 spec/helper.rb
ticketinghub-0.0.4 spec/helper.rb
ticketinghub-0.0.3 spec/helper.rb
ticketinghub-0.0.2 spec/helper.rb