mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 21:52:43 +08:00
DEV: Apply syntax_tree formatting to spec/*
This commit is contained in:
@ -2,10 +2,13 @@
|
||||
|
||||
RSpec.describe Onebox::Engine::GithubBlobOnebox do
|
||||
before do
|
||||
@link = "https://github.com/discourse/onebox/blob/master/lib/onebox/engine/github_blob_onebox.rb"
|
||||
@link =
|
||||
"https://github.com/discourse/onebox/blob/master/lib/onebox/engine/github_blob_onebox.rb"
|
||||
@uri = URI.parse(@link)
|
||||
stub_request(:get, "https://raw.githubusercontent.com/discourse/onebox/master/lib/onebox/engine/github_blob_onebox.rb")
|
||||
.to_return(status: 200, body: onebox_response(described_class.onebox_name))
|
||||
stub_request(
|
||||
:get,
|
||||
"https://raw.githubusercontent.com/discourse/onebox/master/lib/onebox/engine/github_blob_onebox.rb",
|
||||
).to_return(status: 200, body: onebox_response(described_class.onebox_name))
|
||||
end
|
||||
|
||||
include_context "with engines"
|
||||
@ -22,13 +25,18 @@ RSpec.describe Onebox::Engine::GithubBlobOnebox do
|
||||
|
||||
it "does not include blob contents if it is binary" do
|
||||
# stub_request if the response must be binary (ASCII-8BIT)
|
||||
uri = mock('object')
|
||||
uri = mock("object")
|
||||
uri.stubs(:open).returns(File.open("#{Rails.root}/spec/fixtures/pdf/small.pdf", "rb"))
|
||||
URI.stubs(:parse).with(@link).returns(@uri)
|
||||
URI.stubs(:parse).with('https://raw.githubusercontent.com/discourse/onebox/master/lib/onebox/engine/github_blob_onebox.rb').returns(uri)
|
||||
URI
|
||||
.stubs(:parse)
|
||||
.with(
|
||||
"https://raw.githubusercontent.com/discourse/onebox/master/lib/onebox/engine/github_blob_onebox.rb",
|
||||
)
|
||||
.returns(uri)
|
||||
|
||||
expect(html).not_to include('/Pages')
|
||||
expect(html).to include('This file is binary.')
|
||||
expect(html).not_to include("/Pages")
|
||||
expect(html).to include("This file is binary.")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user