Explicitly set github repo in instance presenter spec (#24036)
This commit is contained in:
parent
684a970b3c
commit
2f7a663b0b
1
Gemfile
1
Gemfile
|
@ -117,6 +117,7 @@ end
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
gem 'capybara', '~> 3.38'
|
gem 'capybara', '~> 3.38'
|
||||||
|
gem 'climate_control'
|
||||||
gem 'faker', '~> 3.1'
|
gem 'faker', '~> 3.1'
|
||||||
gem 'json-schema', '~> 3.0'
|
gem 'json-schema', '~> 3.0'
|
||||||
gem 'rack-test', '~> 2.0'
|
gem 'rack-test', '~> 2.0'
|
||||||
|
|
|
@ -784,6 +784,7 @@ DEPENDENCIES
|
||||||
capybara (~> 3.38)
|
capybara (~> 3.38)
|
||||||
charlock_holmes (~> 0.7.7)
|
charlock_holmes (~> 0.7.7)
|
||||||
chewy (~> 7.2)
|
chewy (~> 7.2)
|
||||||
|
climate_control
|
||||||
cocoon (~> 1.2)
|
cocoon (~> 1.2)
|
||||||
color_diff (~> 0.1)
|
color_diff (~> 0.1)
|
||||||
concurrent-ruby
|
concurrent-ruby
|
||||||
|
|
|
@ -89,8 +89,28 @@ describe InstancePresenter do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#source_url' do
|
describe '#source_url' do
|
||||||
it 'returns "https://github.com/mastodon/mastodon"' do
|
context 'with the GITHUB_REPOSITORY env variable set' do
|
||||||
expect(instance_presenter.source_url).to eq('https://github.com/mastodon/mastodon')
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Reference in New Issue