|
107 | 107 |
|
108 | 108 | describe "endpoint configuration" do |
109 | 109 | describe "#notify_endpoint" do |
110 | | - it "defaults to DEFAULT_NOTIFY_ENDPOINT" do |
111 | | - expect(subject.notify_endpoint).to eq(Bugsnag::Configuration::DEFAULT_NOTIFY_ENDPOINT) |
| 110 | + it "defaults to nil" do |
| 111 | + expect(subject.notify_endpoint).to eq(nil) |
112 | 112 | end |
113 | 113 |
|
114 | 114 | it "is readonly" do |
|
121 | 121 | end |
122 | 122 |
|
123 | 123 | describe "#session_endpoint" do |
124 | | - it "defaults to DEFAULT_SESSION_ENDPOINT" do |
125 | | - expect(subject.session_endpoint).to eq(Bugsnag::Configuration::DEFAULT_SESSION_ENDPOINT) |
| 124 | + it "defaults to nil" do |
| 125 | + expect(subject.session_endpoint).to eq(nil) |
126 | 126 | end |
127 | 127 | end |
128 | 128 |
|
| 129 | + describe "#set_default_endpoints" do |
| 130 | + |
| 131 | + end |
| 132 | + |
129 | 133 | describe "#endpoint=" do |
130 | 134 | let(:custom_notify_endpoint) { "My custom notify endpoint" } |
131 | 135 | let(:session_endpoint) { "My session endpoint" } |
|
171 | 175 | end |
172 | 176 |
|
173 | 177 | describe "#endpoints" do |
174 | | - it "defaults to 'DEFAULT_NOTIFY_ENDPOINT' & 'DEFAULT_SESSION_ENDPOINT'" do |
| 178 | + it "defaults to nil & nil" do |
175 | 179 | config = Bugsnag::Configuration.new |
176 | 180 |
|
177 | | - expect(config.endpoints.notify).to eq(Bugsnag::Configuration::DEFAULT_NOTIFY_ENDPOINT) |
178 | | - expect(config.endpoints.sessions).to eq(Bugsnag::Configuration::DEFAULT_SESSION_ENDPOINT) |
| 181 | + expect(config.endpoints.notify).to eq(nil) |
| 182 | + expect(config.endpoints.sessions).to eq(nil) |
179 | 183 | end |
180 | 184 | end |
181 | 185 |
|
|
203 | 207 | expect(config.enable_sessions).to be(false) |
204 | 208 | end |
205 | 209 |
|
206 | | - # TODO: this behaviour exists for backwards compatibilitiy |
| 210 | + # TODO: this behaviour exists for backwards compatibility |
207 | 211 | # ideally we should not send events in this case |
208 | 212 | it "warns and disables sessions if only notify URL is given" do |
209 | 213 | config = Bugsnag::Configuration.new |
@@ -427,6 +431,23 @@ def output_lines |
427 | 431 | '[Bugsnag] WARN: No valid API key has been set, notifications will not be sent' |
428 | 432 | ) |
429 | 433 | end |
| 434 | + |
| 435 | + it "uses the default endpoints for non-hub API keys", :no_configure => true do |
| 436 | + Bugsnag.configure do |config| |
| 437 | + config.api_key = '00002472bd130ac0ab0f52715bbdc600' |
| 438 | + end |
| 439 | + |
| 440 | + expect(Bugsnag.configuration.endpoints.notify).to eq(Bugsnag::Configuration::DEFAULT_NOTIFY_ENDPOINT) |
| 441 | + expect(Bugsnag.configuration.endpoints.sessions).to eq(Bugsnag::Configuration::DEFAULT_SESSION_ENDPOINT) |
| 442 | + end |
| 443 | + |
| 444 | + it "uses the hub endpoints for hub API keys", :no_configure => true do |
| 445 | + Bugsnag.configure do |config| |
| 446 | + config.api_key = '00000472bd130ac0ab0f52715bbdc600' |
| 447 | + end |
| 448 | + expect(Bugsnag.configuration.endpoints.notify).to eq(Bugsnag::Configuration::HUB_NOTIFY_ENDPOINT) |
| 449 | + expect(Bugsnag.configuration.endpoints.sessions).to eq(Bugsnag::Configuration::HUB_SESSION_ENDPOINT) |
| 450 | + end |
430 | 451 | end |
431 | 452 | end |
432 | 453 |
|
|
0 commit comments