Commit 9a6544ae08b340a1cc732835d55171711a7efb01

Authored by Arthur Neves
1 parent 9c4a428d
Exists in master and in 1 other branch production

Fix test on return json for problems api

app/controllers/api/v1/problems_controller.rb
1 class Api::V1::ProblemsController < ApplicationController 1 class Api::V1::ProblemsController < ApplicationController
2 respond_to :json, :xml 2 respond_to :json, :xml
3 - FIELDS = %w{app_id app_name environment message where first_notice_at last_notice_at resolved resolved_at notices_count} 3 + FIELDS = %w{_id app_id app_name environment message where first_notice_at last_notice_at resolved resolved_at notices_count}
4 4
5 def show 5 def show
6 result = benchmark("[api/v1/problems_controller/show] query time") do 6 result = benchmark("[api/v1/problems_controller/show] query time") do
spec/controllers/api/v1/problems_controller_spec.rb
@@ -33,7 +33,7 @@ describe Api::V1::ProblemsController do @@ -33,7 +33,7 @@ describe Api::V1::ProblemsController do
33 get :show, :auth_token => @user.authentication_token, :format => "json", :id => @problem.id 33 get :show, :auth_token => @user.authentication_token, :format => "json", :id => @problem.id
34 34
35 returned_problem = JSON.parse(response.body) 35 returned_problem = JSON.parse(response.body)
36 - expect( returned_problem["_id"] ).to eq(@problem.id.to_s) 36 + expect(returned_problem["_id"]).to eq(@problem.id.to_s)
37 end 37 end
38 38
39 it "should return only the correct fields" do 39 it "should return only the correct fields" do
@@ -43,24 +43,14 @@ describe Api::V1::ProblemsController do @@ -43,24 +43,14 @@ describe Api::V1::ProblemsController do
43 expect( returned_problem.keys ).to match_array([ 43 expect( returned_problem.keys ).to match_array([
44 "app_name", 44 "app_name",
45 "first_notice_at", 45 "first_notice_at",
46 - "error_class",  
47 - "messages",  
48 - "hosts",  
49 - "created_at", 46 + "message",
50 "app_id", 47 "app_id",
51 "last_notice_at", 48 "last_notice_at",
52 "_id", 49 "_id",
53 - "issue_link",  
54 "resolved", 50 "resolved",
55 - "updated_at",  
56 "resolved_at", 51 "resolved_at",
57 - "last_deploy_at",  
58 "where", 52 "where",
59 - "issue_type",  
60 "notices_count", 53 "notices_count",
61 - "user_agents",  
62 - "comments_count",  
63 - "message",  
64 "environment" 54 "environment"
65 ]) 55 ])
66 end 56 end