Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 28 lines (20 sloc) 0.597 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
require File.expand_path('../helper', __FILE__)

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

  def test_push
    svc = service :push, {'subscribers' => 'abc'}, 'a' => 1
    svc.secrets = {'boxcar' => {'apikey' => 'key'}}

    @stubs.post "/github/key" do |env|
      assert_match /(^|\&)emails=abc($|\&)/, env[:body]
      assert_match /(^|\&)payload=%7B%22a%22%3A1%7D($|\&)/, env[:body]
      [200, {}, '']
    end

    svc.receive

    @stubs.verify_stubbed_calls
  end

  def service(*args)
    super Service::Boxcar, *args
  end
end

Something went wrong with that request. Please try again.