Skip to content

Commit fe8ed15

Browse files
committed
🚨 Linting
1 parent 65f452b commit fe8ed15

File tree

4 files changed

+111
-37
lines changed

4 files changed

+111
-37
lines changed

.rubocop_gradual.lock

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,31 @@
1313
"spec/oauth/backwards_compatibility_spec.rb:4041711732": [
1414
[3, 16, 25, "RSpec/DescribeClass: The first argument to describe should be the class or module being tested.", 3956042931]
1515
],
16+
"spec/oauth/tty/authorize_command_spec.rb:3270431476": [
17+
[3, 1, 53, "RSpec/SpecFilePathFormat: Spec path should end with `o_auth/tty/commands/authorize_command*_spec.rb`.", 2667806271],
18+
[14, 34, 17, "RSpec/VerifiedDoubleReference: Use a constant class reference for verified doubles. String references are not verifying unless the class is loaded.", 285748316],
19+
[15, 39, 21, "RSpec/VerifiedDoubleReference: Use a constant class reference for verified doubles. String references are not verifying unless the class is loaded.", 3390344648],
20+
[16, 38, 20, "RSpec/VerifiedDoubleReference: Use a constant class reference for verified doubles. String references are not verifying unless the class is loaded.", 1228090493],
21+
[19, 7, 64, "RSpec/ReceiveMessages: Use `receive_messages` instead of multiple stubs on lines [20].", 1559313276],
22+
[20, 7, 69, "RSpec/ReceiveMessages: Use `receive_messages` instead of multiple stubs on lines [19].", 3030878101],
23+
[22, 7, 23, "RSpec/StubbedMock: Prefer `allow` over `expect` when configuring a response.", 4174421602],
24+
[23, 7, 16, "RSpec/StubbedMock: Prefer `allow` over `expect` when configuring a response.", 3492346277],
25+
[25, 7, 21, "RSpec/StubbedMock: Prefer `allow` over `expect` when configuring a response.", 2407753262],
26+
[26, 7, 21, "RSpec/StubbedMock: Prefer `allow` over `expect` when configuring a response.", 2407753262],
27+
[32, 7, 21, "RSpec/StubbedMock: Prefer `allow` over `expect` when configuring a response.", 2407753262],
28+
[52, 34, 17, "RSpec/VerifiedDoubleReference: Use a constant class reference for verified doubles. String references are not verifying unless the class is loaded.", 285748316],
29+
[54, 7, 23, "RSpec/StubbedMock: Prefer `allow` over `expect` when configuring a response.", 4174421602],
30+
[55, 7, 44, "RSpec/LeakyConstantDeclaration: Stub constant instead of declaring explicitly.", 2395720961],
31+
[57, 7, 16, "RSpec/StubbedMock: Prefer `allow` over `expect` when configuring a response.", 3492346277],
32+
[68, 34, 17, "RSpec/VerifiedDoubleReference: Use a constant class reference for verified doubles. String references are not verifying unless the class is loaded.", 285748316],
33+
[69, 39, 21, "RSpec/VerifiedDoubleReference: Use a constant class reference for verified doubles. String references are not verifying unless the class is loaded.", 3390344648],
34+
[70, 7, 23, "RSpec/StubbedMock: Prefer `allow` over `expect` when configuring a response.", 4174421602],
35+
[71, 7, 16, "RSpec/StubbedMock: Prefer `allow` over `expect` when configuring a response.", 3492346277],
36+
[73, 7, 45, "RSpec/LeakyConstantDeclaration: Stub constant instead of declaring explicitly.", 1997245299],
37+
[75, 7, 21, "RSpec/StubbedMock: Prefer `allow` over `expect` when configuring a response.", 2407753262],
38+
[76, 7, 21, "RSpec/StubbedMock: Prefer `allow` over `expect` when configuring a response.", 2407753262],
39+
[77, 7, 21, "RSpec/StubbedMock: Prefer `allow` over `expect` when configuring a response.", 2407753262]
40+
],
1641
"spec/oauth/tty/cli_spec.rb:361981118": [
1742
[3, 1, 30, "RSpec/SpecFilePathFormat: Spec path should end with `o_auth/tty/cli*_spec.rb`.", 2849860169],
1843
[109, 34, 17, "RSpec/VerifiedDoubleReference: Use a constant class reference for verified doubles. String references are not verifying unless the class is loaded.", 285748316],
@@ -40,6 +65,23 @@
4065
[212, 7, 21, "RSpec/StubbedMock: Prefer `allow` over `expect` when configuring a response.", 2407753262],
4166
[213, 7, 21, "RSpec/StubbedMock: Prefer `allow` over `expect` when configuring a response.", 2407753262]
4267
],
68+
"spec/oauth/tty/command_spec.rb:513689811": [
69+
[3, 1, 34, "RSpec/SpecFilePathFormat: Spec path should end with `o_auth/tty/command*_spec.rb`.", 667110152],
70+
[9, 3, 275, "RSpec/LeakyConstantDeclaration: Stub class constant instead of declaring explicitly.", 2810654211]
71+
],
72+
"spec/oauth/tty/sign_command_spec.rb:622094174": [
73+
[3, 1, 48, "RSpec/SpecFilePathFormat: Spec path should end with `o_auth/tty/commands/sign_command*_spec.rb`.", 3251857167],
74+
[21, 7, 27, "RSpec/StubbedMock: Prefer `allow` over `expect` when configuring a response.", 340848961],
75+
[69, 34, 17, "RSpec/VerifiedDoubleReference: Use a constant class reference for verified doubles. String references are not verifying unless the class is loaded.", 285748316],
76+
[70, 35, 21, "RSpec/VerifiedDoubleReference: Use a constant class reference for verified doubles. String references are not verifying unless the class is loaded.", 3390344648],
77+
[71, 7, 23, "RSpec/StubbedMock: Prefer `allow` over `expect` when configuring a response.", 4174421602],
78+
[72, 7, 16, "RSpec/StubbedMock: Prefer `allow` over `expect` when configuring a response.", 3492346277],
79+
[73, 7, 67, "RSpec/ReceiveMessages: Use `receive_messages` instead of multiple stubs on lines [74, 75].", 42619244],
80+
[74, 7, 87, "RSpec/ReceiveMessages: Use `receive_messages` instead of multiple stubs on lines [73, 75].", 1827647110],
81+
[75, 7, 89, "RSpec/ReceiveMessages: Use `receive_messages` instead of multiple stubs on lines [73, 74].", 1585010367],
82+
[75, 81, 13, "RSpec/VerifiedDoubleReference: Use a constant class reference for verified doubles. String references are not verifying unless the class is loaded.", 4026407386],
83+
[77, 7, 27, "RSpec/StubbedMock: Prefer `allow` over `expect` when configuring a response.", 340848961]
84+
],
4385
"spec/oauth/tty_spec.rb:1891755344": [
4486
[3, 1, 25, "RSpec/EmptyExampleGroup: Empty example group detected.", 208109039],
4587
[3, 1, 25, "RSpec/SpecFilePathFormat: Spec path should end with `o_auth/tty*_spec.rb`.", 208109039]

spec/oauth/tty/authorize_command_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def build_cmd(args = [])
3131

3232
expect(request_token).to receive(:get_access_token).with({oauth_verifier: "VERIFIER"}).and_return(access_token)
3333

34-
out_before = stdout.string.dup
34+
stdout.string.dup
3535
build_cmd(%w[--consumer-key CK --consumer-secret CS --method GET --uri https://example.com]).run
3636

3737
stdout.rewind

spec/oauth/tty/command_spec.rb

Lines changed: 46 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def build_cmd(args = [])
5757
scheme: :header,
5858
method: :post,
5959
params: [],
60-
version: "1.0"
60+
version: "1.0",
6161
)
6262
# Non-deterministic values are present but not asserted for exact value
6363
expect(cmd.send(:options)).to include(:oauth_nonce, :oauth_timestamp)
@@ -80,17 +80,28 @@ def build_cmd(args = [])
8080

8181
it "collects sign/query related switches" do
8282
cmd = build_cmd(%w[
83-
--method GET
84-
--nonce N
85-
--parameters a:1
86-
--parameters raw_pair
87-
--signature-method PLAINTEXT
88-
--token T
89-
--secret S
90-
--timestamp TS
91-
--realm R
92-
--uri http://example.com/
93-
--version 1.0a
83+
--method
84+
GET
85+
--nonce
86+
N
87+
--parameters
88+
a:1
89+
--parameters
90+
raw_pair
91+
--signature-method
92+
PLAINTEXT
93+
--token
94+
T
95+
--secret
96+
S
97+
--timestamp
98+
TS
99+
--realm
100+
R
101+
--uri
102+
http://example.com/
103+
--version
104+
1.0a
94105
])
95106
expect(cmd.send(:options)).to include(
96107
method: "GET",
@@ -101,7 +112,7 @@ def build_cmd(args = [])
101112
oauth_timestamp: "TS",
102113
realm: "R",
103114
uri: "http://example.com/",
104-
oauth_version: "1.0a"
115+
oauth_version: "1.0a",
105116
)
106117
expect(cmd.send(:options)[:params]).to eq(["a:1", "raw_pair"])
107118
end
@@ -113,30 +124,40 @@ def build_cmd(args = [])
113124

114125
it "captures authorization URLs and scope" do
115126
cmd = build_cmd(%w[
116-
--access-token-url https://example.com/access
117-
--authorize-url https://example.com/auth
118-
--callback-url https://example.com/cb
119-
--request-token-url https://example.com/request
120-
--scope email
127+
--access-token-url
128+
https://example.com/access
129+
--authorize-url
130+
https://example.com/auth
131+
--callback-url
132+
https://example.com/cb
133+
--request-token-url
134+
https://example.com/request
135+
--scope
136+
email
121137
])
122138
expect(cmd.send(:options)).to include(
123139
access_token_url: "https://example.com/access",
124140
authorize_url: "https://example.com/auth",
125141
oauth_callback: "https://example.com/cb",
126142
request_token_url: "https://example.com/request",
127-
scope: "email"
143+
scope: "email",
128144
)
129145
end
130146
end
131147

132148
describe "#parameters" do
133149
it "builds escaped params and merges oauth keys, dropping nil/empty ones" do
134150
cmd = build_cmd(%w[
135-
--consumer-key CK
136-
--token TK
137-
--parameters foo:bar
138-
--parameters baz:qux
139-
--parameters raw=pair
151+
--consumer-key
152+
CK
153+
--token
154+
TK
155+
--parameters
156+
foo:bar
157+
--parameters
158+
baz:qux
159+
--parameters
160+
raw=pair
140161
])
141162
params = cmd.send(:parameters)
142163
# CGI.parse returns arrays of values per key
@@ -147,7 +168,7 @@ def build_cmd(args = [])
147168
expect(params).to include(
148169
"oauth_consumer_key" => "CK",
149170
"oauth_token" => "TK",
150-
"oauth_signature_method" => "HMAC-SHA1"
171+
"oauth_signature_method" => "HMAC-SHA1",
151172
)
152173
# timestamp, nonce exist but are not asserted exactly
153174
expect(params).to include("oauth_timestamp", "oauth_nonce")

spec/oauth/tty/sign_command_spec.rb

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ def build_cmd(args = [])
1111

1212
describe "non-verbose output", :check_output do
1313
it "prints only the signature" do
14-
request = double("Request",
14+
request = double(
15+
"Request",
1516
oauth_parameters: {},
1617
non_oauth_parameters: {},
1718
oauth_signature: "SIG",
@@ -21,11 +22,16 @@ def build_cmd(args = [])
2122
expect(request).to receive(:sign!).with(consumer_secret: "CS", token_secret: "TS")
2223

2324
build_cmd(%w[
24-
--consumer-key CK
25-
--consumer-secret CS
26-
--token TK
27-
--secret TS
28-
--uri https://example.com
25+
--consumer-key
26+
CK
27+
--consumer-secret
28+
CS
29+
--token
30+
TK
31+
--secret
32+
TS
33+
--uri
34+
https://example.com
2935
]).run
3036

3137
stdout.rewind
@@ -72,11 +78,16 @@ def build_cmd(args = [])
7278
expect(request).to receive(:sign!).with(consumer_secret: "CS", token_secret: "TS")
7379

7480
build_cmd(%w[
75-
--consumer-key CK
76-
--consumer-secret CS
77-
--token TK
78-
--secret TS
79-
--uri https://example.com
81+
--consumer-key
82+
CK
83+
--consumer-secret
84+
CS
85+
--token
86+
TK
87+
--secret
88+
TS
89+
--uri
90+
https://example.com
8091
--verbose
8192
--xmpp
8293
]).run

0 commit comments

Comments
 (0)