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 1 class Api::V1::ProblemsController < ApplicationController
2 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 5 def show
6 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 33 get :show, :auth_token => @user.authentication_token, :format => "json", :id => @problem.id
34 34  
35 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 37 end
38 38  
39 39 it "should return only the correct fields" do
... ... @@ -43,24 +43,14 @@ describe Api::V1::ProblemsController do
43 43 expect( returned_problem.keys ).to match_array([
44 44 "app_name",
45 45 "first_notice_at",
46   - "error_class",
47   - "messages",
48   - "hosts",
49   - "created_at",
  46 + "message",
50 47 "app_id",
51 48 "last_notice_at",
52 49 "_id",
53   - "issue_link",
54 50 "resolved",
55   - "updated_at",
56 51 "resolved_at",
57   - "last_deploy_at",
58 52 "where",
59   - "issue_type",
60 53 "notices_count",
61   - "user_agents",
62   - "comments_count",
63   - "message",
64 54 "environment"
65 55 ])
66 56 end
... ...