DEV: Avoid instance variables in specs

Small followup of https://github.com/discourse/discourse/pull/27705
This commit is contained in:
Loïc Guitaut
2024-07-11 12:15:48 +02:00
committed by Loïc Guitaut
parent 797f659eed
commit b0480dd34e
7 changed files with 105 additions and 92 deletions

View File

@ -1,17 +1,18 @@
# frozen_string_literal: true
RSpec.describe Onebox::Engine::GithubIssueOnebox do
before do
@link = "https://github.com/discourse/discourse/issues/1"
@issue_uri = "https://api.github.com/repos/discourse/discourse/issues/1"
let(:issue_uri) { "https://api.github.com/repos/discourse/discourse/issues/1" }
stub_request(:get, @issue_uri).to_return(
before do
stub_request(:get, issue_uri).to_return(
status: 200,
body: onebox_response("github_issue_onebox"),
)
end
include_context "with engines"
include_context "with engines" do
let(:link) { "https://github.com/discourse/discourse/issues/1" }
end
it_behaves_like "an engine"
describe "#to_html" do
@ -27,7 +28,7 @@ RSpec.describe Onebox::Engine::GithubIssueOnebox do
it "sends it as part of the request" do
html
expect(WebMock).to have_requested(:get, @issue_uri).with(
expect(WebMock).to have_requested(:get, issue_uri).with(
headers: {
"Authorization" => "Bearer #{SiteSetting.github_onebox_access_token}",
},