I'm trying to test my API with an RSpec-Rails request spec. Here's the spec:
# logged_in_headers is defined above
describe "POST /create" do
it "creates a new campaign" do
post "/api/v2/campaigns", { "data" => {} }, logged_in_headers
expect(JSON.parse(response.body)).to eq({ not_sure: "what" })
end
end
1) /api/v2/campaigns logged in POST /create creates a new campaign
Failure/Error: expect(JSON.parse(response.body)).to eq({ not_sure: "what" })
expected: {:not_sure=>"what"}
got: {"errors"=>[{"title"=>"Missing Parameter", "detail"=>"The required parameter, data, is missing.", "id"=>nil, "href"=>nil, "code"=>106, "path"=>nil, "links"=>nil, "status"=>"bad_request"}]}
(compared using ==)
Diff:
@@ -1,2 +1,2 @@
-:not_sure => "what"
+"errors" => [{"title"=>"Missing Parameter", "detail"=>"The required parameter, data, is missing.", "id"=>nil, "href"=>nil, "code"=>106, "path"=>nil, "links"=>nil, "status"=>"bad_request"}]
It appears the params is not passing through when we're posting. Any ideas?
I'm trying to test my API with an RSpec-Rails request spec. Here's the spec:
I'm getting this error:
It appears the params is not passing through when we're posting. Any ideas?