From 4fed56c0b7de876a934a895164722882fbbd9b83 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Thu, 10 Apr 2025 23:02:23 +0200 Subject: [PATCH 01/11] Add java platform --- Gemfile.lock | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Gemfile.lock b/Gemfile.lock index 65fdbf6..687435e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -26,6 +26,7 @@ GEM base64 (0.2.0) benchmark (0.4.0) bigdecimal (3.1.9) + bigdecimal (3.1.9-java) concurrent-ruby (1.3.5) connection_pool (2.5.0) diff-lcs (1.6.1) @@ -41,6 +42,7 @@ GEM i18n (1.14.7) concurrent-ruby (~> 1.0) json (2.10.2) + json (2.10.2-java) language_server-protocol (3.17.0.4) lint_roller (1.1.0) logger (1.7.0) @@ -57,6 +59,7 @@ GEM prism (1.4.0) public_suffix (6.0.1) racc (1.8.1) + racc (1.8.1-java) rainbow (3.1.1) rake (13.2.1) regexp_parser (2.10.0) @@ -127,6 +130,7 @@ PLATFORMS arm-linux-gnu arm-linux-musl arm64-darwin + java ruby x86-linux-gnu x86-linux-musl From 95231913b10d8c6ca231fbfd63916d1bb3b947e6 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Thu, 10 Apr 2025 23:03:41 +0200 Subject: [PATCH 02/11] Configure standard --- .standard.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .standard.yml diff --git a/.standard.yml b/.standard.yml new file mode 100644 index 0000000..72b2693 --- /dev/null +++ b/.standard.yml @@ -0,0 +1 @@ +ruby_version: 3.1 From d6c5418240dec064ae319a7c80ba221e0afafc8d Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Thu, 10 Apr 2025 23:04:44 +0200 Subject: [PATCH 03/11] Configure simplecov --- spec/spec_helper.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8bd2cca..74b9f24 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,7 +2,11 @@ require "simplecov" -SimpleCov.start +SimpleCov.start do + enable_coverage :branch + + primary_coverage :branch +end require "errbit_plugin" require "errbit_github_plugin" From ea3d9fd7f11909b39d30718765a9a33e8f1d8c4a Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Thu, 10 Apr 2025 23:06:37 +0200 Subject: [PATCH 04/11] In HTML5 we don't need to close tags --- lib/errbit_github_plugin/issue_tracker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/errbit_github_plugin/issue_tracker.rb b/lib/errbit_github_plugin/issue_tracker.rb index e4c31c1..a6b3eaf 100644 --- a/lib/errbit_github_plugin/issue_tracker.rb +++ b/lib/errbit_github_plugin/issue_tracker.rb @@ -7,7 +7,7 @@ class IssueTracker < ErrbitPlugin::IssueTracker LABEL = "github" NOTE = "Please configure your github repository in the GITHUB " \ - "REPO field above.
Instead of providing your " \ + "REPO field above.
Instead of providing your " \ "username & password, you can link your Github account to your " \ "user profile, and allow Errbit to create issues using your " \ "OAuth token." From c31811d36d080e0c33c143486357855bed8a5c49 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Thu, 10 Apr 2025 23:09:21 +0200 Subject: [PATCH 05/11] GitHub --- README.md | 4 ++-- lib/errbit_github_plugin/issue_tracker.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 750e4d0..3b9463c 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# Errbit Github Plugin +# Errbit GitHub Plugin [![RSpec](https://github.com/errbit/errbit_github_plugin/actions/workflows/rspec.yml/badge.svg)](https://github.com/errbit/errbit_github_plugin/actions/workflows/rspec.yml) [![RSpec on JRuby](https://github.com/errbit/errbit_github_plugin/actions/workflows/jruby.yml/badge.svg)](https://github.com/errbit/errbit_github_plugin/actions/workflows/jruby.yml) [![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/standardrb/standard) -This plugin provides GitHub issue tracker integration for Errbit and it is the +This plugin provides GitHub issue tracker integration for Errbit, and it is the only plugin included by default in Errbit. diff --git a/lib/errbit_github_plugin/issue_tracker.rb b/lib/errbit_github_plugin/issue_tracker.rb index a6b3eaf..fbfe57c 100644 --- a/lib/errbit_github_plugin/issue_tracker.rb +++ b/lib/errbit_github_plugin/issue_tracker.rb @@ -6,9 +6,9 @@ module ErrbitGithubPlugin class IssueTracker < ErrbitPlugin::IssueTracker LABEL = "github" - NOTE = "Please configure your github repository in the GITHUB " \ + NOTE = "Please configure your GitHub repository in the GITHUB " \ "REPO field above.
Instead of providing your " \ - "username & password, you can link your Github account to your " \ + "username & password, you can link your GitHub account to your " \ "user profile, and allow Errbit to create issues using your " \ "OAuth token." From 5716f0dd867bc0ac1c3d3bd9b39a629ed1de4d27 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Thu, 10 Apr 2025 23:10:36 +0200 Subject: [PATCH 06/11] Configure RSpec --- .rspec | 3 ++- spec/spec_helper.rb | 15 ++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.rspec b/.rspec index b83d9b7..6c6110e 100644 --- a/.rspec +++ b/.rspec @@ -1,3 +1,4 @@ ---color --format documentation +--color --require spec_helper +--order random diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 74b9f24..05f63c8 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,12 +13,13 @@ require "active_support/all" RSpec.configure do |config| - config.run_all_when_everything_filtered = true - config.filter_run :focus + # Enable flags like --only-failures and --next-failure + config.example_status_persistence_file_path = ".rspec_status" - # Run specs in random order to surface order dependencies. If you find an - # order dependency and want to debug it, you can fix the order by providing - # the seed, which is printed after each run. - # --seed 1234 - config.order = "random" + # Disable RSpec exposing methods globally on `Module` and `main` + config.disable_monkey_patching! + + config.expect_with :rspec do |c| + c.syntax = :expect + end end From 3f2a695d232d5b77a78796bae4ca858cc2d7b0c1 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Thu, 10 Apr 2025 23:12:07 +0200 Subject: [PATCH 07/11] Move spec to right place --- spec/{ => errbit_github_plugin}/issue_tracker_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) rename spec/{ => errbit_github_plugin}/issue_tracker_spec.rb (98%) diff --git a/spec/issue_tracker_spec.rb b/spec/errbit_github_plugin/issue_tracker_spec.rb similarity index 98% rename from spec/issue_tracker_spec.rb rename to spec/errbit_github_plugin/issue_tracker_spec.rb index deca783..81e307d 100644 --- a/spec/issue_tracker_spec.rb +++ b/spec/errbit_github_plugin/issue_tracker_spec.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true -describe ErrbitGithubPlugin::IssueTracker do +require "spec_helper" + +RSpec.describe ErrbitGithubPlugin::IssueTracker do describe ".label" do it "return LABEL" do expect(described_class.label).to eq described_class::LABEL From 45a702c633b1cd64a1514d1e4aaac24616b239e9 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Thu, 10 Apr 2025 23:14:50 +0200 Subject: [PATCH 08/11] Update tests --- spec/errbit_github_plugin/issue_tracker_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/errbit_github_plugin/issue_tracker_spec.rb b/spec/errbit_github_plugin/issue_tracker_spec.rb index 81e307d..c81ad17 100644 --- a/spec/errbit_github_plugin/issue_tracker_spec.rb +++ b/spec/errbit_github_plugin/issue_tracker_spec.rb @@ -110,12 +110,12 @@ end let(:fake_github_client) do double("Fake GitHub Client").tap do |github_client| - github_client.stub(:create_issue).and_return(fake_issue) + expect(github_client).to receive(:create_issue).and_return(fake_issue) end end let(:fake_issue) do double("Fake Issue").tap do |issue| - issue.stub(:html_url).and_return("http://github.com/user/repos/issues/878") + expect(issue).to receive(:html_url).and_return("http://github.com/user/repos/issues/878") end end @@ -127,7 +127,7 @@ } end it "return issue url" do - Octokit::Client.stub(:new).with( + expect(Octokit::Client).to receive(:new).with( login: user["github_login"], access_token: user["github_oauth_token"] ).and_return(fake_github_client) expect(subject).to eq fake_issue.html_url @@ -137,7 +137,7 @@ context "signed in with password" do let(:user) { {} } it "return issue url" do - Octokit::Client.stub(:new).with( + expect(Octokit::Client).to receive(:new).with( login: options["username"], password: options["password"] ).and_return(fake_github_client) expect(subject).to eq fake_issue.html_url @@ -149,7 +149,7 @@ {"github_login" => "alice", "github_oauth_token" => "invalid_token"} end it "raise AuthenticationError" do - Octokit::Client.stub(:new).with( + expect(Octokit::Client).to receive(:new).with( login: user["github_login"], access_token: user["github_oauth_token"] ).and_raise(Octokit::Unauthorized) expect { subject }.to raise_error From ebdbffd5e4dec3e10386bca5cdb730297c8d4ded Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Thu, 10 Apr 2025 23:55:10 +0200 Subject: [PATCH 09/11] Fix tests --- spec/errbit_github_plugin/issue_tracker_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/errbit_github_plugin/issue_tracker_spec.rb b/spec/errbit_github_plugin/issue_tracker_spec.rb index c81ad17..754c4b2 100644 --- a/spec/errbit_github_plugin/issue_tracker_spec.rb +++ b/spec/errbit_github_plugin/issue_tracker_spec.rb @@ -115,7 +115,7 @@ end let(:fake_issue) do double("Fake Issue").tap do |issue| - expect(issue).to receive(:html_url).and_return("http://github.com/user/repos/issues/878") + expect(issue).to receive(:html_url).and_return("http://github.com/user/repos/issues/878").twice end end From 8f0514de7757cc54862b004c8b033ebc6a99e3de Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Thu, 10 Apr 2025 23:57:20 +0200 Subject: [PATCH 10/11] Fix rspec warning --- spec/errbit_github_plugin/issue_tracker_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/errbit_github_plugin/issue_tracker_spec.rb b/spec/errbit_github_plugin/issue_tracker_spec.rb index 754c4b2..921fb7d 100644 --- a/spec/errbit_github_plugin/issue_tracker_spec.rb +++ b/spec/errbit_github_plugin/issue_tracker_spec.rb @@ -152,7 +152,7 @@ expect(Octokit::Client).to receive(:new).with( login: user["github_login"], access_token: user["github_oauth_token"] ).and_raise(Octokit::Unauthorized) - expect { subject }.to raise_error + expect { subject }.to raise_error(ErrbitGithubPlugin::AuthenticationError) end end end From 63ee285e7272a937868d0b5690363fa83fe20f55 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Thu, 10 Apr 2025 23:58:10 +0200 Subject: [PATCH 11/11] Update .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 2e679cf..56dd36c 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,5 @@ tmp *.swp .rspec vendor/bundle +.rspec_status +.idea