Skip to content

Commit 958473e

Browse files
committed
Standard
1 parent 7d6ef43 commit 958473e

File tree

3 files changed

+66
-67
lines changed

3 files changed

+66
-67
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
source 'https://rubygems.org'
3+
source "https://rubygems.org"
44

55
gemspec
66

spec/issue_tracker_spec.rb

Lines changed: 60 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,155 +1,154 @@
11
# frozen_string_literal: true
22

33
describe ErrbitGithubPlugin::IssueTracker do
4-
describe '.label' do
5-
it 'return LABEL' do
4+
describe ".label" do
5+
it "return LABEL" do
66
expect(described_class.label).to eq described_class::LABEL
77
end
88
end
99

10-
describe '.note' do
11-
it 'return NOTE' do
10+
describe ".note" do
11+
it "return NOTE" do
1212
expect(described_class.note).to eq described_class::NOTE
1313
end
1414
end
1515

16-
describe '.fields' do
17-
it 'return FIELDS' do
16+
describe ".fields" do
17+
it "return FIELDS" do
1818
expect(described_class.fields).to eq described_class::FIELDS
1919
end
2020
end
2121

22-
describe '.icons' do
23-
24-
it 'puts create icon onto the icons' do
25-
expect(described_class.icons[:create][0]).to eq 'image/png'
22+
describe ".icons" do
23+
it "puts create icon onto the icons" do
24+
expect(described_class.icons[:create][0]).to eq "image/png"
2625
expect(
2726
described_class.icons[:create][1]
28-
).to eq ErrbitGithubPlugin.read_static_file('github_create.png')
27+
).to eq ErrbitGithubPlugin.read_static_file("github_create.png")
2928
end
3029

31-
it 'puts goto icon onto the icons' do
32-
expect(described_class.icons[:goto][0]).to eq 'image/png'
30+
it "puts goto icon onto the icons" do
31+
expect(described_class.icons[:goto][0]).to eq "image/png"
3332
expect(
3433
described_class.icons[:goto][1]
35-
).to eq ErrbitGithubPlugin.read_static_file('github_goto.png')
34+
).to eq ErrbitGithubPlugin.read_static_file("github_goto.png")
3635
end
3736

38-
it 'puts inactive icon onto the icons' do
39-
expect(described_class.icons[:inactive][0]).to eq 'image/png'
37+
it "puts inactive icon onto the icons" do
38+
expect(described_class.icons[:inactive][0]).to eq "image/png"
4039
expect(
4140
described_class.icons[:inactive][1]
42-
).to eq ErrbitGithubPlugin.read_static_file('github_inactive.png')
41+
).to eq ErrbitGithubPlugin.read_static_file("github_inactive.png")
4342
end
4443
end
4544

4645
let(:tracker) { described_class.new(options) }
4746

48-
describe '#configured?' do
49-
context 'with errors' do
50-
let(:options) { { invalid_key: '' } }
51-
it 'return false' do
47+
describe "#configured?" do
48+
context "with errors" do
49+
let(:options) { {invalid_key: ""} }
50+
it "return false" do
5251
expect(tracker.configured?).to eq false
5352
end
5453
end
55-
context 'without errors' do
54+
context "without errors" do
5655
let(:options) do
57-
{ username: 'foo', password: 'bar', github_repo: 'user/repos' }
56+
{username: "foo", password: "bar", github_repo: "user/repos"}
5857
end
59-
it 'return true' do
58+
it "return true" do
6059
expect(tracker.configured?).to eq true
6160
end
6261
end
6362
end
6463

65-
describe '#url' do
66-
let(:options) { { github_repo: 'repo' } }
67-
it 'returns issues url' do
68-
expect(tracker.url).to eq 'https://github.com/repo/issues'
64+
describe "#url" do
65+
let(:options) { {github_repo: "repo"} }
66+
it "returns issues url" do
67+
expect(tracker.url).to eq "https://github.com/repo/issues"
6968
end
7069
end
7170

72-
describe '#errors' do
71+
describe "#errors" do
7372
subject { tracker.errors }
74-
context 'without username' do
75-
let(:options) { { username: '', password: 'bar', github_repo: 'repo' } }
73+
context "without username" do
74+
let(:options) { {username: "", password: "bar", github_repo: "repo"} }
7675
it { is_expected.not_to be_empty }
7776
end
78-
context 'without password' do
77+
context "without password" do
7978
let(:options) do
80-
{ username: '', password: 'bar', github_repo: 'repo' }
79+
{username: "", password: "bar", github_repo: "repo"}
8180
end
8281
it { is_expected.not_to be_empty }
8382
end
84-
context 'without github_repo' do
83+
context "without github_repo" do
8584
let(:options) do
86-
{ username: 'foo', password: 'bar', github_repo: '' }
85+
{username: "foo", password: "bar", github_repo: ""}
8786
end
8887
it { is_expected.not_to be_empty }
8988
end
90-
context 'with completed options' do
89+
context "with completed options" do
9190
let(:options) do
92-
{ username: 'foo', password: 'bar', github_repo: 'repo' }
91+
{username: "foo", password: "bar", github_repo: "repo"}
9392
end
9493
it { is_expected.to be_empty }
9594
end
9695
end
9796

98-
describe '#repo' do
99-
let(:options) { { github_repo: 'baz' } }
100-
it 'returns github repo' do
101-
expect(tracker.repo).to eq 'baz'
97+
describe "#repo" do
98+
let(:options) { {github_repo: "baz"} }
99+
it "returns github repo" do
100+
expect(tracker.repo).to eq "baz"
102101
end
103102
end
104103

105-
describe '#create_issue' do
106-
subject { tracker.create_issue('title', 'body', user: user) }
104+
describe "#create_issue" do
105+
subject { tracker.create_issue("title", "body", user: user) }
107106
let(:options) do
108-
{ username: 'foo', password: 'bar', github_repo: 'user/repos' }
107+
{username: "foo", password: "bar", github_repo: "user/repos"}
109108
end
110109
let(:fake_github_client) do
111-
double('Fake GitHub Client').tap do |github_client|
110+
double("Fake GitHub Client").tap do |github_client|
112111
github_client.stub(:create_issue).and_return(fake_issue)
113112
end
114113
end
115114
let(:fake_issue) do
116-
double('Fake Issue').tap do |issue|
117-
issue.stub(:html_url).and_return('http://github.com/user/repos/issues/878')
115+
double("Fake Issue").tap do |issue|
116+
issue.stub(:html_url).and_return("http://github.com/user/repos/issues/878")
118117
end
119118
end
120119

121-
context 'signed in with token' do
120+
context "signed in with token" do
122121
let(:user) do
123122
{
124-
'github_login' => 'bob',
125-
'github_oauth_token' => 'valid_token'
123+
"github_login" => "bob",
124+
"github_oauth_token" => "valid_token"
126125
}
127126
end
128-
it 'return issue url' do
127+
it "return issue url" do
129128
Octokit::Client.stub(:new).with(
130-
login: user['github_login'], access_token: user['github_oauth_token']
129+
login: user["github_login"], access_token: user["github_oauth_token"]
131130
).and_return(fake_github_client)
132131
expect(subject).to eq fake_issue.html_url
133132
end
134133
end
135134

136-
context 'signed in with password' do
135+
context "signed in with password" do
137136
let(:user) { {} }
138-
it 'return issue url' do
139-
(Octokit::Client).stub(:new).with(
140-
login: options['username'], password: options['password']
137+
it "return issue url" do
138+
Octokit::Client.stub(:new).with(
139+
login: options["username"], password: options["password"]
141140
).and_return(fake_github_client)
142141
expect(subject).to eq fake_issue.html_url
143142
end
144143
end
145144

146-
context 'when unauthentication error' do
145+
context "when unauthentication error" do
147146
let(:user) do
148-
{ 'github_login' => 'alice', 'github_oauth_token' => 'invalid_token' }
147+
{"github_login" => "alice", "github_oauth_token" => "invalid_token"}
149148
end
150-
it 'raise AuthenticationError' do
151-
(Octokit::Client).stub(:new).with(
152-
login: user['github_login'], access_token: user['github_oauth_token']
149+
it "raise AuthenticationError" do
150+
Octokit::Client.stub(:new).with(
151+
login: user["github_login"], access_token: user["github_oauth_token"]
153152
).and_raise(Octokit::Unauthorized)
154153
expect { subject }.to raise_error
155154
end

spec/spec_helper.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# frozen_string_literal: true
22

3-
require 'simplecov'
3+
require "simplecov"
44

55
SimpleCov.start
66

7-
require 'errbit_plugin'
8-
require 'errbit_github_plugin'
9-
require 'active_support/all'
7+
require "errbit_plugin"
8+
require "errbit_github_plugin"
9+
require "active_support/all"
1010

1111
RSpec.configure do |config|
1212
config.run_all_when_everything_filtered = true
@@ -16,5 +16,5 @@
1616
# order dependency and want to debug it, you can fix the order by providing
1717
# the seed, which is printed after each run.
1818
# --seed 1234
19-
config.order = 'random'
19+
config.order = "random"
2020
end

0 commit comments

Comments
 (0)