discourse/spec/lib/onebox/engine/gitlab_blob_onebox_spec.rb
David Taylor c9dab6fd08
DEV: Automatically require 'rails_helper' in all specs (#16077)
It's very easy to forget to add `require 'rails_helper'` at the top of every core/plugin spec file, and omissions can cause some very confusing/sporadic errors.

By setting this flag in `.rspec`, we can remove the need for `require 'rails_helper'` entirely.
2022-03-01 17:50:50 +00:00

24 lines
672 B
Ruby

# frozen_string_literal: true
describe Onebox::Engine::GitlabBlobOnebox do
before do
@link = "https://gitlab.com/discourse/onebox/blob/master/lib/onebox/engine/gitlab_blob_onebox.rb"
stub_request(:get, "https://gitlab.com/discourse/onebox/raw/master/lib/onebox/engine/gitlab_blob_onebox.rb")
.to_return(status: 200, body: onebox_response(described_class.onebox_name))
end
include_context "engines"
it_behaves_like "an engine"
describe "#to_html" do
it "includes file name" do
expect(html).to include("gitlab_blob_onebox.rb")
end
it "includes blob contents" do
expect(html).to include("module Onebox")
end
end
end