mirror of
https://github.com/discourse/discourse.git
synced 2025-06-08 22:39:22 +08:00
DEV: Absorb onebox gem into core (#12979)
* Move onebox gem in core library * Update template file path * Remove warning for onebox gem caching * Remove onebox version file * Remove onebox gem * Add sanitize gem * Require onebox library in lazy-yt plugin * Remove onebox web specific code This code was used in standalone onebox Sinatra application * Merge Discourse specific AllowlistedGenericOnebox engine in core * Fix onebox engine filenames to match class name casing * Move onebox specs from gem into core * DEV: Rename `response` helper to `onebox_response` Fixes a naming collision. * Require rails_helper * Don't use `before/after(:all)` * Whitespace * Remove fakeweb * Remove poor unit tests * DEV: Re-add fakeweb, plugins are using it * Move onebox helpers * Stub Instagram API * FIX: Follow additional redirect status codes (#476) Don’t throw errors if we encounter 303, 307 or 308 HTTP status codes in responses * Remove an empty file * DEV: Update the license file Using the copy from https://choosealicense.com/licenses/gpl-2.0/# Hopefully this will enable GitHub to show the license UI? * DEV: Update embedded copyrights * DEV: Add Onebox copyright notice * DEV: Add MIT license, convert COPYRIGHT.txt to md * DEV: Remove an incorrect copyright claim Co-authored-by: Jarek Radosz <jradosz@gmail.com> Co-authored-by: jbrw <jamie@goatforce5.org>
This commit is contained in:
53
spec/lib/onebox/engine/github_pullrequest_onebox_spec.rb
Normal file
53
spec/lib/onebox/engine/github_pullrequest_onebox_spec.rb
Normal file
@ -0,0 +1,53 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "rails_helper"
|
||||
|
||||
describe Onebox::Engine::GithubPullRequestOnebox do
|
||||
before do
|
||||
@link = "https://github.com/discourse/discourse/pull/1253/"
|
||||
@uri = "https://api.github.com/repos/discourse/discourse/pulls/1253"
|
||||
|
||||
stub_request(:get, @uri).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 pull request author" do
|
||||
expect(html).to include("jamesaanderson")
|
||||
end
|
||||
|
||||
it "includes repository name" do
|
||||
expect(html).to include("discourse")
|
||||
end
|
||||
|
||||
it "includes commit author gravatar" do
|
||||
expect(html).to include("b3e9977094ce189bbb493cf7f9adea21")
|
||||
end
|
||||
|
||||
it "includes commit time and date" do
|
||||
expect(html).to include("02:05AM - 26 Jul 13")
|
||||
end
|
||||
|
||||
it "includes number of commits" do
|
||||
expect(html).to include("1")
|
||||
end
|
||||
|
||||
it "includes number of files changed" do
|
||||
expect(html).to include("4")
|
||||
end
|
||||
|
||||
it "includes number of additions" do
|
||||
expect(html).to include("19")
|
||||
end
|
||||
|
||||
it "includes number of deletions" do
|
||||
expect(html).to include("1")
|
||||
end
|
||||
|
||||
it "includes the body" do
|
||||
expect(html).to include("http://meta.discourse.org/t/audio-html5-tag/8168")
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user