Skip to content
Merged
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ tmp
*.swp
.rspec
vendor/bundle
.rspec_status
.idea
3 changes: 2 additions & 1 deletion .rspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--color
--format documentation
--color
--require spec_helper
--order random
1 change: 1 addition & 0 deletions .standard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby_version: 3.1
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -127,6 +130,7 @@ PLATFORMS
arm-linux-gnu
arm-linux-musl
arm64-darwin
java
ruby
x86-linux-gnu
x86-linux-musl
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 3 additions & 3 deletions lib/errbit_github_plugin/issue_tracker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ module ErrbitGithubPlugin
class IssueTracker < ErrbitPlugin::IssueTracker
LABEL = "github"

NOTE = "Please configure your github repository in the <strong>GITHUB " \
"REPO</strong> field above.<br/> Instead of providing your " \
"username & password, you can link your Github account to your " \
NOTE = "Please configure your GitHub repository in the <strong>GITHUB " \
"REPO</strong> field above.<br> 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."

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -108,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").twice
end
end

Expand All @@ -125,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
Expand All @@ -135,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
Expand All @@ -147,10 +149,10 @@
{"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
expect { subject }.to raise_error(ErrbitGithubPlugin::AuthenticationError)
end
end
end
Expand Down
21 changes: 13 additions & 8 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@

require "simplecov"

SimpleCov.start
SimpleCov.start do
enable_coverage :branch

primary_coverage :branch
end

require "errbit_plugin"
require "errbit_github_plugin"
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"

# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!

# 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"
config.expect_with :rspec do |c|
c.syntax = :expect
end
end