diff --git a/Gemfile b/Gemfile
index eaaf1bf1fc85cbc42480856cf72cb933b8f045f1..7a836b6ba4d1c5c17bdf7f8478a930ca8acc646c 100644
--- a/Gemfile
+++ b/Gemfile
@@ -117,6 +117,7 @@ end
 
 group :test do
   gem 'capybara', '~> 3.38'
+  gem 'climate_control'
   gem 'faker', '~> 3.1'
   gem 'json-schema', '~> 3.0'
   gem 'rack-test', '~> 2.0'
diff --git a/Gemfile.lock b/Gemfile.lock
index bd1aece57680796ba2bac374edc6287af957123b..e5ad5bfe54252910e7f2da8214b76cbb2a728f2f 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -784,6 +784,7 @@ DEPENDENCIES
   capybara (~> 3.38)
   charlock_holmes (~> 0.7.7)
   chewy (~> 7.2)
+  climate_control
   cocoon (~> 1.2)
   color_diff (~> 0.1)
   concurrent-ruby
diff --git a/spec/presenters/instance_presenter_spec.rb b/spec/presenters/instance_presenter_spec.rb
index 29170a79ae95acf4fe9a3db5e8cd705d615895b3..795abd8b453c9d48ef8a7355bfa69c120df0d418 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/mastodon/mastodon"' do
-      expect(instance_presenter.source_url).to eq('https://github.com/mastodon/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 mastodon repo URL' do
+        expect(instance_presenter.source_url).to eq('https://github.com/mastodon/mastodon')
+      end
     end
   end