Skip to content

Update spec failure when running on forks#24027

Closed
nschonni wants to merge 1 commit intomastodon:mainfrom
nschonni:source_url-for-foks
Closed

Update spec failure when running on forks#24027
nschonni wants to merge 1 commit intomastodon:mainfrom
nschonni:source_url-for-foks

Conversation

@nschonni
Copy link
Contributor

@nschonni nschonni commented Mar 8, 2023

Not sure this is the best fix, but it was annoying that this test would always fail when pushing to my fork. Seemed a little better than just commenting it out, but maybe @mjankowski has a better idea

@nschonni
Copy link
Contributor Author

nschonni commented Mar 8, 2023

Unrelated "lint" faillure will be addressed either by #23997 or having it move like in #23713

it 'returns "https://github.com/mastodon/mastodon"' do
expect(instance_presenter.source_url).to eq('https://github.com/mastodon/mastodon')
it 'returns the repo address' do
expect(instance_presenter.source_url).to eq("https://github.com/#{ENV.fetch('GITHUB_REPOSITORY')}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will fix the CI environment where that env var is set, but will break local runs where the env var is not set.

It looks like the implementation tries to use the env var if set, and then falls back to mastodon/mastodon if not set.

One way to resolve this would be to split this spec into two contexts -- one with the env var set and one without the env var set; but instead of relying on it just happening to be present or not in the env its being run in, use an rspec around block to explicitly set/unset the var for those conditions, and have the spec verify we're getting the expected result in each case.

@ClearlyClaire
Copy link
Contributor

That is an interesting side-effect of migrating tests to GitHub… The variable wasn't set when running on CircleCI.

@ClearlyClaire
Copy link
Contributor

Superseded by #24036

@nschonni nschonni deleted the source_url-for-foks branch March 9, 2023 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants