Commit a71b0626 authored by Vitali Tatarintev's avatar Vitali Tatarintev

Extract stub_sentry_request method

Extract stub_sentry_request into a SentryClientHelpers
parent 8b79e803
......@@ -3,6 +3,8 @@
require 'spec_helper'
describe Sentry::Client::Projects do
include SentryClientHelpers
let(:sentry_url) { 'https://sentrytest.gitlab.com/api/0/projects/sentry-org/sentry-project' }
let(:token) { 'test-token' }
let(:client) { Sentry::Client.new(sentry_url, token) }
......@@ -114,15 +116,4 @@ describe Sentry::Client::Projects do
it_behaves_like 'maps Sentry exceptions'
end
end
private
def stub_sentry_request(url, body: {}, status: 200, headers: {})
stub_request(:get, url)
.to_return(
status: status,
headers: { 'Content-Type' => 'application/json' }.merge(headers),
body: body.to_json
)
end
end
......@@ -3,6 +3,8 @@
require 'spec_helper'
describe Sentry::Client do
include SentryClientHelpers
let(:sentry_url) { 'https://sentrytest.gitlab.com/api/0/projects/sentry-org/sentry-project' }
let(:token) { 'test-token' }
let(:default_httparty_options) do
......@@ -216,15 +218,4 @@ describe Sentry::Client do
it_behaves_like 'issues has correct length', 1
end
end
private
def stub_sentry_request(url, body: {}, status: 200, headers: {})
stub_request(:get, url)
.to_return(
status: status,
headers: { 'Content-Type' => 'application/json' }.merge(headers),
body: body.to_json
)
end
end
# frozen_string_literal: true
module SentryClientHelpers
private
def stub_sentry_request(url, body: {}, status: 200, headers: {})
stub_request(:get, url)
.to_return(
status: status,
headers: { 'Content-Type' => 'application/json' }.merge(headers),
body: body.to_json
)
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment