Sha256: f59b91736d552680430438fd29ceceb60d1dff494f76bd350b96bfbba4d5d856

Contents?: true

Size: 1.08 KB

Versions: 37

Compression:

Stored size: 1.08 KB

Contents

shared_examples_for "a webhook" do |verb|
  it "should #{verb} to the given uri" do
    request = stub_request(verb, "www.example.com")
    Expressive.run("(#{verb} \"http://www.example.com\")")
    assert_requested(request)
  end

  it "should add an entry in the errors element of the scope" do
    message = 'Something went Pete Tong'
    exception = RestClient::Exception.new
    exception.message = message
    stub_request(verb, 'www.example.com').to_raise(exception)
    Expressive.run("(#{verb} \"http://www.example.com\")", @scope)
    @scope['_errors'].should eql message
  end

  it "should add an entry in the errors element of the scope" do
    stub_request(verb, "badexample.com").to_raise(RestClient::ResourceNotFound.new)
    Expressive.run("(#{verb} \"badexample.com\")", @scope)
    @scope['_errors'].should eql 'Resource Not Found'
  end

  it "should add an entry in the errors element of the scope" do
    stub_request(verb, 'www.example.com').to_timeout
    Expressive.run("(#{verb} \"http://www.example.com\")", @scope)
    @scope['_errors'].should eql 'Request Timeout'
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
expressive-0.0.22 spec/webhook_examples.rb
expressive-0.0.21 spec/webhook_examples.rb
expressive-0.0.20 spec/webhook_examples.rb
expressive-0.0.18 spec/webhook_examples.rb
expressive-0.0.17 spec/webhook_examples.rb
expressive-0.0.16 spec/webhook_examples.rb
expressive-0.0.15 spec/webhook_examples.rb
expressive-0.0.14 spec/webhook_examples.rb
expressive-0.0.13 spec/webhook_examples.rb
expressive-0.0.12 spec/webhook_examples.rb
expressive-0.0.11 spec/webhook_examples.rb
expressive-0.0.10 spec/webhook_examples.rb
expressive-0.0.9 spec/webhook_examples.rb
expressive-0.0.8 spec/webhook_examples.rb
expressive-0.0.7 spec/webhook_examples.rb
expressive-0.0.6 spec/webhook_examples.rb
expressive-0.0.5 spec/webhook_examples.rb