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.42 spec/webhook_examples.rb
expressive-0.0.41 spec/webhook_examples.rb
expressive-0.0.40 spec/webhook_examples.rb
expressive-0.0.39 spec/webhook_examples.rb
expressive-0.0.38 spec/webhook_examples.rb
expressive-0.0.37 spec/webhook_examples.rb
expressive-0.0.36 spec/webhook_examples.rb
expressive-0.0.35 spec/webhook_examples.rb
expressive-0.0.34 spec/webhook_examples.rb
expressive-0.0.33 spec/webhook_examples.rb
expressive-0.0.32 spec/webhook_examples.rb
expressive-0.0.31 spec/webhook_examples.rb
expressive-0.0.30 spec/webhook_examples.rb
expressive-0.0.29 spec/webhook_examples.rb
expressive-0.0.28 spec/webhook_examples.rb
expressive-0.0.27 spec/webhook_examples.rb
expressive-0.0.26 spec/webhook_examples.rb
expressive-0.0.25 spec/webhook_examples.rb
expressive-0.0.24 spec/webhook_examples.rb
expressive-0.0.23 spec/webhook_examples.rb