File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,11 @@ class Client
12
12
# Loads the configuration from an url in the environment
13
13
def self . from_env ( key = 'PUSHER_URL' )
14
14
url = ENV [ key ] || raise ( ConfigurationError , key )
15
+ from_url ( url )
16
+ end
17
+
18
+ # Loads the configuration from a url
19
+ def self . from_url ( url )
15
20
client = new
16
21
client . url = url
17
22
client
Original file line number Diff line number Diff line change 125
125
end
126
126
end
127
127
128
+ describe 'configuring from url' do
129
+ it "works" do
130
+ url = "http://somekey:somesecret@api.staging.pusherapp.com:8080/apps/87"
131
+
132
+ client = Pusher ::Client . from_url ( url )
133
+ expect ( client . key ) . to eq ( "somekey" )
134
+ expect ( client . secret ) . to eq ( "somesecret" )
135
+ expect ( client . app_id ) . to eq ( "87" )
136
+ expect ( client . url . to_s ) . to eq ( "http://api.staging.pusherapp.com:8080/apps/87" )
137
+ end
138
+ end
139
+
128
140
describe 'when configured' do
129
141
before :each do
130
142
@client . app_id = '20'
You can’t perform that action at this time.
0 commit comments