-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathbrowserless_fetch_configs_spec.rb
More file actions
36 lines (28 loc) · 1.21 KB
/
browserless_fetch_configs_spec.rb
File metadata and controls
36 lines (28 loc) · 1.21 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
# frozen_string_literal: true
RSpec.describe BrowserlessFetchConfigs do
describe '.browserless_env_configured?' do
around do |example|
original_ws_url = ENV['BROWSERLESS_IO_WEBSOCKET_URL']
original_api_token = ENV['BROWSERLESS_IO_API_TOKEN']
example.run
ensure
ENV['BROWSERLESS_IO_WEBSOCKET_URL'] = original_ws_url
ENV['BROWSERLESS_IO_API_TOKEN'] = original_api_token
end
it 'accepts the documented local Browserless websocket URL without a token' do
ENV['BROWSERLESS_IO_WEBSOCKET_URL'] = 'ws://127.0.0.1:4002'
ENV['BROWSERLESS_IO_API_TOKEN'] = ''
expect(described_class.browserless_env_configured?).to be(true)
end
it 'accepts the legacy local Browserless websocket URL without a token' do
ENV['BROWSERLESS_IO_WEBSOCKET_URL'] = 'ws://127.0.0.1:3000'
ENV['BROWSERLESS_IO_API_TOKEN'] = ''
expect(described_class.browserless_env_configured?).to be(true)
end
it 'requires a token for non-local websocket URLs' do
ENV['BROWSERLESS_IO_WEBSOCKET_URL'] = 'wss://production.browserless.example/ws'
ENV['BROWSERLESS_IO_API_TOKEN'] = ''
expect(described_class.browserless_env_configured?).to be(false)
end
end
end