Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/fbe/octo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,12 @@ def repository(name)
full_name = name.is_a?(Integer) ? 'yegor256/test' : name
full_name = 'zerocracy/baza' if name == 1439
full_name = 'foo/bazz' if name == 810
size =
case name
when 'yegor256/empty-repo' then 0
when 'yegor256/nil-size-repo' then nil
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Yegorov why this may happen? It looks like a bug in GitHub API.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@yegor256 Yes, it looks like a bug, but it could also be something with the token's access rights.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Yegorov maybe we should fix the root cause: access rights problem. This change looks like a simulation of something that never happens in reality.

Copy link
Copy Markdown
Contributor Author

@Yegorov Yegorov Oct 28, 2025

Choose a reason for hiding this comment

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

@yegor256 Unfortunately, I can't help here, as I don't have the full context of the situation.
Can you make a request to view information about the repository with this token?

else 470
end
{
id: name_to_number(name),
full_name:,
Expand All @@ -628,7 +634,7 @@ def repository(name)
created_at: random_time,
updated_at: random_time,
pushed_at: random_time,
size: name == 'yegor256/empty-repo' ? 0 : 470,
size:,
stargazers_count: 1,
watchers_count: 1,
language: 'Ruby',
Expand Down
12 changes: 12 additions & 0 deletions test/fbe/test_octo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,18 @@ def test_fetches_fake_not_found_repos
assert_raises(Octokit::NotFound) { o.repository(404_124) }
end

def test_fetches_fake_empty_repo
Fbe.octo(loog: Loog::NULL, global: {}, options: Judges::Options.new({ 'testing' => true })).then do |o|
assert_equal(0, o.repository('yegor256/empty-repo')[:size])
end
end

def test_fetches_fake_nil_size_repo
Fbe.octo(loog: Loog::NULL, global: {}, options: Judges::Options.new({ 'testing' => true })).then do |o|
assert_nil(o.repository('yegor256/nil-size-repo')[:size])
end
end

def test_fetches_fake_zerocracy_baza_repo
o = Fbe.octo(loog: Loog::NULL, global: {}, options: Judges::Options.new({ 'testing' => true }))
assert_equal('zerocracy/baza', o.repository(1439)[:full_name])
Expand Down