This repository was archived by the owner on Jul 19, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-12
lines changed Expand file tree Collapse file tree 2 files changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -85,19 +85,17 @@ def update_status_pending
85
85
end
86
86
87
87
def update_status ( state , description )
88
- if config . update_status
89
- params = {
90
- state : state ,
91
- description : description ,
92
- target_url : @payload [ "details_url" ] ,
93
- context : "codeclimate"
94
- }
95
- service_post ( status_url , params . to_json )
96
- end
88
+ params = {
89
+ state : state ,
90
+ description : description ,
91
+ target_url : @payload [ "details_url" ] ,
92
+ context : "codeclimate"
93
+ }
94
+ service_post ( status_url , params . to_json )
97
95
end
98
96
99
97
def add_comment
100
- if config . add_comment && !comment_present?
98
+ if !comment_present?
101
99
body = {
102
100
body : COMMENT_BODY % @payload [ "compare_url" ]
103
101
} . to_json
@@ -106,6 +104,8 @@ def add_comment
106
104
doc = JSON . parse ( response . body )
107
105
{ id : doc [ "id" ] }
108
106
end
107
+ else
108
+ { ok : false , message : "Comment already present" }
109
109
end
110
110
end
111
111
Original file line number Diff line number Diff line change @@ -38,7 +38,6 @@ def test_pull_request_status_error
38
38
commit_sha : "abc123" ,
39
39
state : "error" ,
40
40
} )
41
-
42
41
end
43
42
44
43
def test_pull_request_status_test_success
@@ -115,11 +114,13 @@ def test_pull_request_comment_already_present
115
114
116
115
# With no POST expectation, test will fail if request is made.
117
116
118
- receive_pull_request ( { add_comment : true } , {
117
+ rsp = receive_pull_request ( { add_comment : true , update_status : false } , {
119
118
github_slug : "pbrisbin/foo" ,
120
119
number : 1 ,
121
120
state : "success" ,
122
121
} )
122
+ assert_not_nil rsp
123
+ assert_false rsp [ :ok ]
123
124
end
124
125
125
126
private
You can’t perform that action at this time.
0 commit comments