Sha256: f8aef04c1a12be5d527984f6ba6291783a0712a9790e5dc937fc84dacb68173f

Contents?: true

Size: 600 Bytes

Versions: 8

Compression:

Stored size: 600 Bytes

Contents

require_relative '../spec_helper'

describe Barometer::Utils::Post do
  describe ".call" do
    it "posts http content to a given address" do
      stub_request(:post, "www.example.com").to_return(body: "Hello World")

      content = Barometer::Utils::Post.call('www.example.com', foo: :bar)
      content.should include('Hello World')
    end

    it "raises Barometer::TimeoutError when it times out" do
      stub_request(:post, "www.example.com").to_timeout

      expect {
        Barometer::Utils::Post.call('www.example.com')
      }.to raise_error(Barometer::TimeoutError)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
barometer-0.9.7 spec/utils/post_spec.rb
barometer-0.9.6 spec/utils/post_spec.rb
barometer-0.9.5 spec/utils/post_spec.rb
barometer-0.9.4 spec/utils/post_spec.rb
barometer-0.9.3 spec/utils/post_spec.rb
barometer-0.9.2 spec/utils/post_spec.rb
barometer-0.9.1 spec/utils/post_spec.rb
barometer-0.9.0 spec/utils/post_spec.rb