Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

41 lines (31 sloc) 1.05 kb
require File.expand_path('../helper', __FILE__)
class CodeClimateTest < Service::TestCase
def setup
@stubs = Faraday::Adapter::Test::Stubs.new
@svc = service(data, payload)
end
def test_reads_token_from_data
assert_equal "5373dd4a3648b88fa9acb8e46ebc188a", @svc.token
end
def test_strips_whitespace_from_token
svc = service({'token' => '5373dd4a3648b88fa9acb8e46ebc188a '}, payload)
assert_equal '5373dd4a3648b88fa9acb8e46ebc188a', svc.token
end
def test_posts_payload
@stubs.post '/github_pushes' do |env|
assert_equal 'https', env[:url].scheme
assert_equal 'codeclimate.com', env[:url].host
assert_equal basic_auth('github', '5373dd4a3648b88fa9acb8e46ebc188a'),
env[:request_headers]['authorization']
assert_equal payload, JSON.parse(Rack::Utils.parse_query(env[:body])['payload'])
end
@svc.receive_push
end
private
def service(*args)
super Service::CodeClimate, *args
end
def data
{ 'token' => '5373dd4a3648b88fa9acb8e46ebc188a' }
end
end
Jump to Line
Something went wrong with that request. Please try again.