webhooks_controller_spec.rb 1.0KB

1234567891011121314151617181920
  1. require 'spec_helper'
  2. describe "routing for webhooks" do
  3. it "routes to handle_request" do
  4. resulting_params = { :user_id => "6", :agent_id => "2", :secret => "foobar" }
  5. get("/users/6/webhooks/2/foobar").should route_to("webhooks#handle_request", resulting_params)
  6. post("/users/6/webhooks/2/foobar").should route_to("webhooks#handle_request", resulting_params)
  7. put("/users/6/webhooks/2/foobar").should route_to("webhooks#handle_request", resulting_params)
  8. delete("/users/6/webhooks/2/foobar").should route_to("webhooks#handle_request", resulting_params)
  9. end
  10. it "routes with format" do
  11. get("/users/6/webhooks/2/foobar.json").should route_to("webhooks#handle_request",
  12. { :user_id => "6", :agent_id => "2", :secret => "foobar", :format => "json" })
  13. get("/users/6/webhooks/2/foobar.atom").should route_to("webhooks#handle_request",
  14. { :user_id => "6", :agent_id => "2", :secret => "foobar", :format => "atom" })
  15. end
  16. end