Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

28 lines (22 sloc) 0.686 kB
require File.expand_path('../helper', __FILE__)
class TogglTest < Service::TestCase
def setup
@stubs = Faraday::Adapter::Test::Stubs.new
end
def test_push
url = "/api/v5/tasks.json"
@stubs.post url do |env|
assert_equal 'www.toggl.com', env[:url].host
assert_equal basic_auth(:a, :api_token), env[:request_headers]['authorization']
assert_equal 900, JSON.parse(env[:body])['task']['duration']
[200, {}, '']
end
modified = payload.dup
modified['commits'].first['message'].sub! /f:/, 't:'
svc = service({'api_token' => 'a'}, modified)
svc.receive_push
end
def service(*args)
super Service::Toggl, *args
end
end
Jump to Line
Something went wrong with that request. Please try again.