mirror of
https://github.com/discourse/discourse.git
synced 2026-08-06 13:08:40 +08:00
The original theme component was created on the author's repository, which means when checking if the component is installed we should check for variations of both remote urls.
38 lines
1.5 KiB
Ruby
Vendored
38 lines
1.5 KiB
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
RSpec.describe DiscourseGifs do
|
|
describe ".component_installed?" do
|
|
it "returns false when no discourse-gifs theme component exists" do
|
|
expect(described_class.component_installed?).to eq(false)
|
|
end
|
|
|
|
it "returns true when the component is installed via the canonical URL" do
|
|
remote_theme = RemoteTheme.create!(remote_url: "https://github.com/discourse/discourse-gifs")
|
|
Fabricate(:theme, component: true, remote_theme: remote_theme)
|
|
|
|
expect(described_class.component_installed?).to eq(true)
|
|
end
|
|
|
|
it "returns true when the component is installed via the .git URL" do
|
|
remote_theme =
|
|
RemoteTheme.create!(remote_url: "https://github.com/discourse/discourse-gifs.git")
|
|
Fabricate(:theme, component: true, remote_theme: remote_theme)
|
|
|
|
expect(described_class.component_installed?).to eq(true)
|
|
end
|
|
|
|
it "returns true when installed via the author's repo" do
|
|
remote_theme = RemoteTheme.create!(remote_url: "https://github.com/xfalcox/discourse-gifs")
|
|
Fabricate(:theme, component: true, remote_theme: remote_theme)
|
|
|
|
expect(described_class.component_installed?).to eq(true)
|
|
end
|
|
|
|
it "returns false for forks or similarly-named repos that the migration task would not match" do
|
|
remote_theme = RemoteTheme.create!(remote_url: "https://github.com/myorg/discourse-gifs.git")
|
|
Fabricate(:theme, component: true, remote_theme: remote_theme)
|
|
|
|
expect(described_class.component_installed?).to eq(false)
|
|
end
|
|
end
|
|
end
|