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
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ Elegant/GoodMethodName:
- workflow_run
- workflow_run_job
- workflow_run_usage
- workflow_runs
Naming/MethodParameterName:
AllowedNames:
- as
Expand Down
14 changes: 14 additions & 0 deletions lib/fbe/fake_octokit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,20 @@ def repository_workflow_runs(repo, _opts = {})
}
end

# Lists runs of one workflow in a repository.
#
# @param [String] repo The repository name
# @param [Integer, String] _workflow The workflow ID or file name
# @param [Hash] _opts Options hash (ignored in mock)
# @return [Hash] Hash with total_count and workflow_runs array
# @example
# fake_client = Fbe::FakeOctokit.new
# result = fake_client.workflow_runs('octocat/Hello-World', 42, status: 'success')
# result[:total_count] #=> 2
def workflow_runs(repo, _workflow, _opts = {})
repository_workflow_runs(repo)
end

# Gets usage information for a specific workflow run.
#
# @param [String] _repo The repository name
Expand Down
10 changes: 10 additions & 0 deletions test/fbe/test_octo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1672,4 +1672,14 @@ def test_fake_workflow_run_always_has_status
refute_nil(result[:repository], "for workflow run #{id}")
end
end

def test_fake_workflow_runs
o = Fbe.octo(loog: Loog::NULL, global: {}, options: Judges::Options.new({ 'testing' => true }))
result =
o.with_disable_auto_paginate do |ob|
ob.workflow_runs('yegor256/test', 42, status: 'success', per_page: 1)
end
assert_equal(2, result[:total_count])
refute_empty(result[:workflow_runs], 'The fake must return some workflow runs')
end
end
Loading