Sha256: 3a5ebfcd533d0e2434cbb6e3fefbc63c68e291483d41334fc63472dfcacbbb55

Contents?: true

Size: 697 Bytes

Versions: 5

Compression:

Stored size: 697 Bytes

Contents

require File.expand_path("../../spec_helper", __FILE__)

describe CukeQ::Reporter do

  def reporter
    @reporter ||= CukeQ::Reporter.new(URI.parse("http://example.com/some/path"))
  end

  it "POSTs results to the given URL" do
    expected_params = {
      :host    => "example.com",
      :port    => 80,
      :verb    => 'POST',
      :request => '/some/path',
      :content => '{"some":"result"}'
    }

    EM::P::HttpClient.should_receive(:request).with(expected_params)
    reporter.report("some" => "result")
  end

  it "catches and logs EM errors" do
    reporter.should_receive(:log)
    EM::P::HttpClient.stub!(:request).and_raise(RuntimeError)

    reporter.report(nil)
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cukeq-0.0.1.dev5 spec/cukeq/reporter_spec.rb
cukeq-0.0.1.dev4 spec/cukeq/reporter_spec.rb
cukeq-0.0.1.dev3 spec/cukeq/reporter_spec.rb
cukeq-0.0.1.dev2 spec/cukeq/reporter_spec.rb
cukeq-0.0.1.dev spec/cukeq/reporter_spec.rb