Sha256: 1b192a917f79d5dca68c1c38165cf543194c007a47d82c2e885ccb6808fb0844

Contents?: true

Size: 911 Bytes

Versions: 2

Compression:

Stored size: 911 Bytes

Contents

require 'spec_helper'

describe 'CapistranoPayload::Request' do
  include CapistranoPayload
  
  it 'raises DeliveryError on failed request' do
    stub_request(:post, "http://localhost:4567/fail").
      with(:body => fixture('payload.form'), :headers => {'Content-Type'=>'application/x-www-form-urlencoded'}).
      to_return(:status => 404, :headers => {})
    
    p = Payload.new('deploy', 'Comment', PAYLOAD, :form)
    proc { p.deliver('http://localhost:4567/fail') }.
      should raise_error DeliveryError, "404 Resource Not Found"
  end
  
  it 'delivers a payload' do
    stub_request(:post, "http://foo.bar.com/payload").
      with(:body => fixture('payload.form'), :headers => {'Content-Type'=>'application/x-www-form-urlencoded'}).
      to_return(:status => 200, :headers => {})
    
    p = Payload.new('deploy', 'Comment', PAYLOAD, :form)
    p.deliver('http://foo.bar.com/payload')
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
capistrano-payload-0.4.0 spec/request_spec.rb
capistrano-payload-0.3.0 spec/request_spec.rb