Skip to content

Commit 033b0e7

Browse files
authored
Updates (#18)
* Add java platform * Configure standard * Configure simplecov * In HTML5 we don't need to close tags * GitHub * Configure RSpec * Move spec to right place * Update tests * Fix tests * Fix rspec warning * Update .gitignore
1 parent 9158c2d commit 033b0e7

File tree

8 files changed

+36
-21
lines changed

8 files changed

+36
-21
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ tmp
1717
*.swp
1818
.rspec
1919
vendor/bundle
20+
.rspec_status
21+
.idea

.rspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
--color
21
--format documentation
2+
--color
33
--require spec_helper
4+
--order random

.standard.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ruby_version: 3.1

Gemfile.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ GEM
2626
base64 (0.2.0)
2727
benchmark (0.4.0)
2828
bigdecimal (3.1.9)
29+
bigdecimal (3.1.9-java)
2930
concurrent-ruby (1.3.5)
3031
connection_pool (2.5.0)
3132
diff-lcs (1.6.1)
@@ -41,6 +42,7 @@ GEM
4142
i18n (1.14.7)
4243
concurrent-ruby (~> 1.0)
4344
json (2.10.2)
45+
json (2.10.2-java)
4446
language_server-protocol (3.17.0.4)
4547
lint_roller (1.1.0)
4648
logger (1.7.0)
@@ -57,6 +59,7 @@ GEM
5759
prism (1.4.0)
5860
public_suffix (6.0.1)
5961
racc (1.8.1)
62+
racc (1.8.1-java)
6063
rainbow (3.1.1)
6164
rake (13.2.1)
6265
regexp_parser (2.10.0)
@@ -127,6 +130,7 @@ PLATFORMS
127130
arm-linux-gnu
128131
arm-linux-musl
129132
arm64-darwin
133+
java
130134
ruby
131135
x86-linux-gnu
132136
x86-linux-musl

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Errbit Github Plugin
1+
# Errbit GitHub Plugin
22

33
[![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)
44
[![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)
55
[![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/standardrb/standard)
66

7-
This plugin provides GitHub issue tracker integration for Errbit and it is the
7+
This plugin provides GitHub issue tracker integration for Errbit, and it is the
88
only plugin included by default in Errbit.

lib/errbit_github_plugin/issue_tracker.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ module ErrbitGithubPlugin
66
class IssueTracker < ErrbitPlugin::IssueTracker
77
LABEL = "github"
88

9-
NOTE = "Please configure your github repository in the <strong>GITHUB " \
10-
"REPO</strong> field above.<br/> Instead of providing your " \
11-
"username & password, you can link your Github account to your " \
9+
NOTE = "Please configure your GitHub repository in the <strong>GITHUB " \
10+
"REPO</strong> field above.<br> Instead of providing your " \
11+
"username & password, you can link your GitHub account to your " \
1212
"user profile, and allow Errbit to create issues using your " \
1313
"OAuth token."
1414

spec/issue_tracker_spec.rb renamed to spec/errbit_github_plugin/issue_tracker_spec.rb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# frozen_string_literal: true
22

3-
describe ErrbitGithubPlugin::IssueTracker do
3+
require "spec_helper"
4+
5+
RSpec.describe ErrbitGithubPlugin::IssueTracker do
46
describe ".label" do
57
it "return LABEL" do
68
expect(described_class.label).to eq described_class::LABEL
@@ -108,12 +110,12 @@
108110
end
109111
let(:fake_github_client) do
110112
double("Fake GitHub Client").tap do |github_client|
111-
github_client.stub(:create_issue).and_return(fake_issue)
113+
expect(github_client).to receive(:create_issue).and_return(fake_issue)
112114
end
113115
end
114116
let(:fake_issue) do
115117
double("Fake Issue").tap do |issue|
116-
issue.stub(:html_url).and_return("http://github.com/user/repos/issues/878")
118+
expect(issue).to receive(:html_url).and_return("http://github.com/user/repos/issues/878").twice
117119
end
118120
end
119121

@@ -125,7 +127,7 @@
125127
}
126128
end
127129
it "return issue url" do
128-
Octokit::Client.stub(:new).with(
130+
expect(Octokit::Client).to receive(:new).with(
129131
login: user["github_login"], access_token: user["github_oauth_token"]
130132
).and_return(fake_github_client)
131133
expect(subject).to eq fake_issue.html_url
@@ -135,7 +137,7 @@
135137
context "signed in with password" do
136138
let(:user) { {} }
137139
it "return issue url" do
138-
Octokit::Client.stub(:new).with(
140+
expect(Octokit::Client).to receive(:new).with(
139141
login: options["username"], password: options["password"]
140142
).and_return(fake_github_client)
141143
expect(subject).to eq fake_issue.html_url
@@ -147,10 +149,10 @@
147149
{"github_login" => "alice", "github_oauth_token" => "invalid_token"}
148150
end
149151
it "raise AuthenticationError" do
150-
Octokit::Client.stub(:new).with(
152+
expect(Octokit::Client).to receive(:new).with(
151153
login: user["github_login"], access_token: user["github_oauth_token"]
152154
).and_raise(Octokit::Unauthorized)
153-
expect { subject }.to raise_error
155+
expect { subject }.to raise_error(ErrbitGithubPlugin::AuthenticationError)
154156
end
155157
end
156158
end

spec/spec_helper.rb

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,24 @@
22

33
require "simplecov"
44

5-
SimpleCov.start
5+
SimpleCov.start do
6+
enable_coverage :branch
7+
8+
primary_coverage :branch
9+
end
610

711
require "errbit_plugin"
812
require "errbit_github_plugin"
913
require "active_support/all"
1014

1115
RSpec.configure do |config|
12-
config.run_all_when_everything_filtered = true
13-
config.filter_run :focus
16+
# Enable flags like --only-failures and --next-failure
17+
config.example_status_persistence_file_path = ".rspec_status"
18+
19+
# Disable RSpec exposing methods globally on `Module` and `main`
20+
config.disable_monkey_patching!
1421

15-
# Run specs in random order to surface order dependencies. If you find an
16-
# order dependency and want to debug it, you can fix the order by providing
17-
# the seed, which is printed after each run.
18-
# --seed 1234
19-
config.order = "random"
22+
config.expect_with :rspec do |c|
23+
c.syntax = :expect
24+
end
2025
end

0 commit comments

Comments
 (0)