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

@ -12,18 +12,16 @@ module OneboxHelpers
end
RSpec.shared_context "with engines" do
before do
fixture = defined?(@onebox_fixture) ? @onebox_fixture : described_class.onebox_name
stub_request(:get, defined?(@uri) ? @uri : @link).to_return(
status: 200,
body: onebox_response(fixture),
)
end
let(:onebox) { described_class.new(link) }
let(:html) { onebox.to_html }
let(:data) { onebox.send(:data).deep_symbolize_keys }
let(:link) { @link }
let(:uri) { defined?(@uri) ? @uri : link }
before do
fixture = defined?(@onebox_fixture) ? @onebox_fixture : described_class.onebox_name
stub_request(:get, uri).to_return(status: 200, body: onebox_response(fixture))
end
end
RSpec.shared_examples_for "an engine" do