Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 33 lines (28 sloc) 0.724 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
require File.expand_path('../helper', __FILE__)

class ZohoProjectsTest < Service::TestCase
  def setup
    @stubs = Faraday::Adapter::Test::Stubs.new
  end

  def data
    {
      "project_id" => "1234",
      "token" => "a13d",
    }
  end

  def test_push
    url = "/serviceHook"
    @stubs.post url do |env|
      assert_equal 'projects.zoho.com', env[:url].host
      params = Rack::Utils.parse_query env[:body]
      assert_equal '1234', params['pId']
      assert_equal 'a13d', params['authtoken']
      assert_equal payload.to_json, params['payload']
      [200, {}, '']
    end

    svc = service :push, data , payload
    svc.receive
  end

  def service(*args)
    super Service::ZohoProjects, *args
  end
end
Something went wrong with that request. Please try again.