Skip to content

Commit

Permalink
RVM and Debian 12
Browse files Browse the repository at this point in the history
Fixing unit test

Signed-off-by: Rodrigo Nardi <[email protected]>
  • Loading branch information
RodrigoMNardi committed Sep 10, 2024
1 parent 9212b43 commit e625ab1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
20 changes: 12 additions & 8 deletions app/github_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ def sinatra_logger_level
end

post '/update/status' do
content_type :json

logger = GithubLogger.instance.create('github_app.log', GithubApp.sinatra_logger_level)

@payload_raw = request.body.read
@payload = JSON.parse(@payload_raw)
@payload = JSON.parse(fetch_message)

logger.debug "Received event UpdateStatus: #{@payload}"

Expand All @@ -73,7 +74,7 @@ def sinatra_logger_level
post '/slack' do
halt 401 unless slack_authentication

payload = JSON.parse(request.body.read)
payload = JSON.parse(fetch_message)

logger.debug "Received Slack command: #{payload.inspect}"
puts "Received Slack command: #{payload.inspect}"
Expand All @@ -90,7 +91,7 @@ def sinatra_logger_level
post '/slack/settings' do
halt 401 unless slack_authentication

payload = JSON.parse(request.body.read)
payload = fetch_message

logger.debug "Received Slack command: #{payload.inspect}"

Expand All @@ -104,12 +105,10 @@ def sinatra_logger_level

logger = GithubLogger.instance.create('github_app.log', GithubApp.sinatra_logger_level)

request.body.rewind
body = request.body.read
body = fetch_message
log_header(logger, body)

@payload_raw = body
payload = JSON.parse(@payload_raw)
payload = JSON.parse(body)

authenticate_request

Expand Down Expand Up @@ -181,6 +180,11 @@ def slack_authentication
def basic_encode(account, password)
"Basic #{["#{account}:#{password}"].pack('m0')}"
end

def fetch_message
request.body.rewind
@payload_raw = request.body.read
end
end

# :nocov:
Expand Down
3 changes: 2 additions & 1 deletion spec/app/github_app_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,8 @@
context 'when fetch settings' do
let(:headers) do
{
'HTTP_AUTHORIZATION' => auth
'HTTP_AUTHORIZATION' => auth,
'HTTP_ACCEPT' => 'application/json'
}
end

Expand Down

0 comments on commit e625ab1

Please sign in to comment.