mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-06 16:31:57 +08:00
27 lines
1 KiB
Ruby
27 lines
1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
describe DiscourseGithubPlugin::GithubRepo do
|
|
before { enable_current_plugin }
|
|
|
|
it "strips .git from url" do
|
|
SiteSetting.github_badges_repos = "https://github.com/discourse/discourse.git"
|
|
repo = DiscourseGithubPlugin::GithubRepo.repos.first
|
|
expect(repo.name).to eq("discourse/discourse")
|
|
end
|
|
|
|
it "strips trailing slash from url" do
|
|
SiteSetting.github_badges_repos = "https://github.com/discourse/discourse/"
|
|
repo = DiscourseGithubPlugin::GithubRepo.repos.first
|
|
expect(repo.name).to eq("discourse/discourse")
|
|
end
|
|
|
|
it "doesn't raise an error when the site setting follows the user/repo format" do
|
|
SiteSetting.github_badges_repos = "discourse/discourse-github"
|
|
repo = DiscourseGithubPlugin::GithubRepo.repos.first
|
|
expect(repo.name).to eq("discourse/discourse-github")
|
|
|
|
SiteSetting.github_badges_repos = "discourse/somerepo_with-numbers7"
|
|
repo = DiscourseGithubPlugin::GithubRepo.repos.first
|
|
expect(repo.name).to eq("discourse/somerepo_with-numbers7")
|
|
end
|
|
end
|