forked from octokit/octokit.rb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoctokit_spec.rb
46 lines (40 loc) · 1.16 KB
/
octokit_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
require 'helper'
describe Octokit do
before do
Octokit.reset!
end
after do
Octokit.reset!
end
it "sets defaults" do
Octokit::Configurable.keys.each do |key|
expect(Octokit.instance_variable_get(:"@#{key}")).to eq(Octokit::Default.send(key))
end
end
describe ".client" do
it "creates an Octokit::Client" do
expect(Octokit.client).to be_kind_of Octokit::Client
end
it "caches the client when the same options are passed" do
expect(Octokit.client).to eq(Octokit.client)
end
it "returns a fresh client when options are not the same" do
client = Octokit.client
Octokit.access_token = "87614b09dd141c22800f96f11737ade5226d7ba8"
client_two = Octokit.client
client_three = Octokit.client
expect(client).not_to eq(client_two)
expect(client_three).to eq(client_two)
end
end
describe ".configure" do
Octokit::Configurable.keys.each do |key|
it "sets the #{key.to_s.gsub('_', ' ')}" do
Octokit.configure do |config|
config.send("#{key}=", key)
end
expect(Octokit.instance_variable_get(:"@#{key}")).to eq(key)
end
end
end
end