forked from tmatilai/github_api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub_spec.rb
More file actions
119 lines (92 loc) · 3.01 KB
/
github_spec.rb
File metadata and controls
119 lines (92 loc) · 3.01 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# encoding: utf-8
require 'spec_helper'
describe Github do
after do
subject.set_defaults
reset_authentication_for subject
end
it "should respond to 'new' message" do
subject.should respond_to :new
end
it "should receive 'new' and initialize subject::Client instance" do
subject.new.should be_a Github::Client
end
it "should respond to 'configure' message" do
subject.should respond_to :configure
end
describe "setting configuration options" do
it "should return default adapter" do
subject.adapter.should == Github::Configuration::DEFAULT_ADAPTER
end
it "should allow to set adapter" do
subject.adapter = :typhoeus
subject.adapter.should == :typhoeus
end
it "should return the default end point" do
subject.endpoint.should == Github::Configuration::DEFAULT_ENDPOINT
end
it "should allow to set endpoint" do
subject.endpoint = 'http://linkedin.com'
subject.endpoint.should == 'http://linkedin.com'
end
it "should return the default user agent" do
subject.user_agent.should == Github::Configuration::DEFAULT_USER_AGENT
end
it "should allow to set new user agent" do
subject.user_agent = 'New User Agent'
subject.user_agent.should == 'New User Agent'
end
it "should have not set oauth token" do
subject.oauth_token.should be_nil
end
it "should allow to set oauth token" do
subject.oauth_token = ''
end
it "should have not set default user" do
subject.user.should be_nil
end
it "should allow to set new user" do
subject.user = 'github'
subject.user.should == 'github'
end
it "should have not set default repository" do
subject.repo.should be_nil
end
it "should allow to set new repository" do
subject.repo = 'github'
subject.repo.should == 'github'
end
it "should have connection options as hash" do
subject.connection_options.should be_a Hash
end
it "should not have connection options as an array" do
subject.should_not be Array
end
it "should initialize connection options to empty hash" do
subject.connection_options.should be_empty
end
it "shoulve have not set user's login" do
subject.login.should be_nil
end
it "should have not set user's password" do
subject.password.should be_nil
end
it "should have set mime type to json" do
subject.mime_type.should == :json
end
it "should allow to set current api client" do
subject.should respond_to :api_client=
subject.should respond_to :api_client
end
end
describe ".configure" do
Github::Configuration::VALID_OPTIONS_KEYS.each do |key|
it "should set the #{key}" do
Github.configure do |config|
config.send("#{key}=", key)
Github.send(key).should == key
end
end
end
end
end # Github