mirror of
https://github.com/discourse/discourse.git
synced 2024-12-18 21:30:04 +08:00
723d7de18c
* FIX: Improve GitHub folder regexp in Onebox It used to match any GitHub URL that was not matched by the other GitHub Oneboxes and it did not do a good job at handling those. With this change, the generic Onebox will handle the remaining URLs. * FEATURE: Add Onebox for GitHub Actions * FEATURE: Add Onebox for PR check runs * FIX: Remove image from GitHub folder Oneboxes It is a generic, auto-generated image which does not provide any value. * DEV: Add tests * FIX: Strip HTML comments from PR body
55 lines
1.4 KiB
Ruby
55 lines
1.4 KiB
Ruby
# 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 without comments" do
|
|
expect(html).to include("http://meta.discourse.org/t/audio-html5-tag/8168")
|
|
expect(html).not_to include("test comment")
|
|
end
|
|
end
|
|
end
|