Commit 61a40c895da980a6d7646460268219c7fac2fdf0
1 parent
7ac8a6a2
Exists in
master
Make Problem#url use the configured protocol
Showing
2 changed files
with
23 additions
and
0 deletions
Show diff stats
app/models/problem.rb
spec/models/problem_spec.rb
... | ... | @@ -475,4 +475,26 @@ describe Problem, type: 'model' do |
475 | 475 | end |
476 | 476 | end |
477 | 477 | end |
478 | + | |
479 | + context "#url" do | |
480 | + subject { Fabricate(:problem) } | |
481 | + | |
482 | + it "uses the configured protocol" do | |
483 | + allow(Errbit::Config).to receive(:protocol).and_return("https") | |
484 | + | |
485 | + expect(subject.url).to eq "https://errbit.example.com/apps/#{subject.app.id}/problems/#{subject.id}" | |
486 | + end | |
487 | + | |
488 | + it "uses the configured host" do | |
489 | + allow(Errbit::Config).to receive(:host).and_return("memyselfandi.com") | |
490 | + | |
491 | + expect(subject.url).to eq "http://memyselfandi.com/apps/#{subject.app.id}/problems/#{subject.id}" | |
492 | + end | |
493 | + | |
494 | + it "uses the configured port" do | |
495 | + allow(Errbit::Config).to receive(:port).and_return(8123) | |
496 | + | |
497 | + expect(subject.url).to eq "http://errbit.example.com:8123/apps/#{subject.app.id}/problems/#{subject.id}" | |
498 | + end | |
499 | + end | |
478 | 500 | end | ... | ... |