File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ 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
+ def self . from_url ( url )
15
19
client = new
16
20
client . url = url
17
21
client
Original file line number Diff line number Diff line change 122
122
end
123
123
end
124
124
125
+ describe 'configuring from url' do
126
+ it "works" do
127
+ url = "http://somekey:somesecret@api.staging.pusherapp.com:8080/apps/87"
128
+
129
+ client = Pusher ::Client . from_url ( url )
130
+ expect ( client . key ) . to eq ( "somekey" )
131
+ expect ( client . secret ) . to eq ( "somesecret" )
132
+ expect ( client . app_id ) . to eq ( "87" )
133
+ expect ( client . url . to_s ) . to eq ( "http://api.staging.pusherapp.com:8080/apps/87" )
134
+ end
135
+ end
136
+
125
137
describe 'when configured' do
126
138
before :each do
127
139
@client . app_id = '20'
You can’t perform that action at this time.
0 commit comments