about summary refs log tree commit diff
path: root/spec/presenters
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2023-03-16 23:09:53 +0100
committerGitHub <noreply@github.com>2023-03-16 23:09:53 +0100
commitf5daa20f2a90098c9d689c5ec9d95ce9887b3a33 (patch)
treea225407cb43edf3fa9d9ac0100021a380e11ff91 /spec/presenters
parent6a0ed45aa3f11f0343a7be556b36b4d075ba08df (diff)
parent32418f0ff3e7f25ca67334585d6d8442b34cb4af (diff)
Merge pull request #2134 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'spec/presenters')
-rw-r--r--spec/presenters/instance_presenter_spec.rb24
1 files changed, 22 insertions, 2 deletions
diff --git a/spec/presenters/instance_presenter_spec.rb b/spec/presenters/instance_presenter_spec.rb
index 43b1c4043..a598d5858 100644
--- a/spec/presenters/instance_presenter_spec.rb
+++ b/spec/presenters/instance_presenter_spec.rb
@@ -89,8 +89,28 @@ describe InstancePresenter do
   end
 
   describe '#source_url' do
-    it 'returns "https://github.com/glitch-soc/mastodon"' do
-      expect(instance_presenter.source_url).to eq('https://github.com/glitch-soc/mastodon')
+    context 'with the GITHUB_REPOSITORY env variable set' do
+      around do |example|
+        ClimateControl.modify GITHUB_REPOSITORY: 'other/repo' do
+          example.run
+        end
+      end
+
+      it 'uses the env variable to build a repo URL' do
+        expect(instance_presenter.source_url).to eq('https://github.com/other/repo')
+      end
+    end
+
+    context 'without the GITHUB_REPOSITORY env variable set' do
+      around do |example|
+        ClimateControl.modify GITHUB_REPOSITORY: nil do
+          example.run
+        end
+      end
+
+      it 'defaults to the core glitch-soc repo URL' do
+        expect(instance_presenter.source_url).to eq('https://github.com/glitch-soc/mastodon')
+      end
     end
   end