|
@@ -29,7 +29,7 @@ describe WebRequestsController do
|
|
|
post :handle_request, params: {:user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5"}
|
|
|
expect(@agent.reload.last_web_request_at).to be_within(2).of(Time.now)
|
|
|
expect(response.body).to eq("success")
|
|
|
- expect(response).to be_success
|
|
|
+ expect(response).to be_successful
|
|
|
end
|
|
|
|
|
|
it "should call receive_web_request" do
|
|
@@ -40,12 +40,12 @@ describe WebRequestsController do
|
|
|
expect(@agent.memory[:web_request_method]).to eq("post")
|
|
|
expect(response.body).to eq("success")
|
|
|
expect(response.headers['Content-Type']).to eq('text/plain; charset=utf-8')
|
|
|
- expect(response).to be_success
|
|
|
+ expect(response).to be_successful
|
|
|
|
|
|
post :handle_request, params: {:user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "not_my_secret", :no => "go"}
|
|
|
expect(@agent.reload.memory[:web_request_values]).not_to eq({ 'no' => "go" })
|
|
|
expect(response.body).to eq("failure")
|
|
|
- expect(response).to be_missing
|
|
|
+ expect(response.status).to eq(404)
|
|
|
end
|
|
|
|
|
|
it "should accept gets" do
|
|
@@ -55,7 +55,7 @@ describe WebRequestsController do
|
|
|
expect(@agent.memory[:web_request_format]).to eq("text/html")
|
|
|
expect(@agent.memory[:web_request_method]).to eq("get")
|
|
|
expect(response.body).to eq("success")
|
|
|
- expect(response).to be_success
|
|
|
+ expect(response).to be_successful
|
|
|
end
|
|
|
|
|
|
it "should pass through the received format" do
|
|
@@ -109,12 +109,12 @@ describe WebRequestsController do
|
|
|
|
|
|
it "should fail on incorrect users" do
|
|
|
post :handle_request, params: {:user_id => users(:jane).to_param, :agent_id => @agent.id, :secret => "my_secret", :no => "go"}
|
|
|
- expect(response).to be_missing
|
|
|
+ expect(response.status).to eq(404)
|
|
|
end
|
|
|
|
|
|
it "should fail on incorrect agents" do
|
|
|
post :handle_request, params: {:user_id => users(:bob).to_param, :agent_id => 454545, :secret => "my_secret", :no => "go"}
|
|
|
- expect(response).to be_missing
|
|
|
+ expect(response.status).to eq(404)
|
|
|
end
|
|
|
|
|
|
describe "legacy update_location endpoint" do
|
|
@@ -141,7 +141,7 @@ describe WebRequestsController do
|
|
|
|
|
|
it "should raise a 404 error when given an invalid user id" do
|
|
|
post :update_location, params: {user_id: "123", secret: "not_my_secret", longitude: 123, latitude: 45, something: "else"}
|
|
|
- expect(response).to be_missing
|
|
|
+ expect(response.status).to eq(404)
|
|
|
end
|
|
|
|
|
|
it "should only look at agents with the given secret" do
|