From 8eb1a5df492726a409f76baea8e93bd2537dd28c Mon Sep 17 00:00:00 2001 From: devil Date: Sun, 4 Oct 2026 14:08:15 +0000 Subject: [PATCH 1/2] #1398: add `workflow_runs` to `Fbe::FakeOctokit` --- lib/fbe/fake_octokit.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/fbe/fake_octokit.rb b/lib/fbe/fake_octokit.rb index 20f1141a..2752ab34 100644 --- a/lib/fbe/fake_octokit.rb +++ b/lib/fbe/fake_octokit.rb @@ -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 From 544fbbf5091832aaf1e670821f8697a34358ac21 Mon Sep 17 00:00:00 2001 From: devil Date: Sun, 4 Oct 2026 14:10:31 +0000 Subject: [PATCH 2/2] #1398: test the fake `workflow_runs` and allow its name --- .rubocop.yml | 1 + test/fbe/test_octo.rb | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index 0def896e..756d7085 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -113,6 +113,7 @@ Elegant/GoodMethodName: - workflow_run - workflow_run_job - workflow_run_usage + - workflow_runs Naming/MethodParameterName: AllowedNames: - as diff --git a/test/fbe/test_octo.rb b/test/fbe/test_octo.rb index 9efa8b8a..37f53706 100644 --- a/test/fbe/test_octo.rb +++ b/test/fbe/test_octo.rb @@ -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