|
20 | 20 | expect(@client.host).to eq('api-mt1.pusher.com')
|
21 | 21 | end
|
22 | 22 |
|
23 |
| - it 'should be preconfigured for port 80' do |
24 |
| - expect(@client.port).to eq(80) |
| 23 | + it 'should be preconfigured for port 443' do |
| 24 | + expect(@client.port).to eq(443) |
25 | 25 | end
|
26 | 26 |
|
27 | 27 | it 'should use standard logger if no other logger if defined' do
|
|
116 | 116 | end
|
117 | 117 |
|
118 | 118 | describe 'configuring TLS' do
|
119 |
| - it 'should set port and scheme if "use_tls" enabled' do |
| 119 | + it 'should set port and scheme if "use_tls" disabled' do |
120 | 120 | client = Pusher::Client.new({
|
121 |
| - :use_tls => true, |
| 121 | + :use_tls => false, |
122 | 122 | })
|
123 |
| - expect(client.scheme).to eq('https') |
124 |
| - expect(client.port).to eq(443) |
| 123 | + expect(client.scheme).to eq('http') |
| 124 | + expect(client.port).to eq(80) |
125 | 125 | end
|
126 | 126 |
|
127 |
| - it 'should set port and scheme if "encrypted" enabled' do |
| 127 | + it 'should set port and scheme if "encrypted" disabled' do |
128 | 128 | client = Pusher::Client.new({
|
129 |
| - :encrypted => true, |
| 129 | + :encrypted => false, |
130 | 130 | })
|
131 |
| - expect(client.scheme).to eq('https') |
132 |
| - expect(client.port).to eq(443) |
| 131 | + expect(client.scheme).to eq('http') |
| 132 | + expect(client.port).to eq(80) |
133 | 133 | end
|
134 | 134 |
|
135 |
| - it 'should use non-TLS port and scheme if "encrypted" or "use_tls" are not set' do |
| 135 | + it 'should use TLS port and scheme if "encrypted" or "use_tls" are not set' do |
136 | 136 | client = Pusher::Client.new
|
137 |
| - expect(client.scheme).to eq('http') |
138 |
| - expect(client.port).to eq(80) |
| 137 | + expect(client.scheme).to eq('https') |
| 138 | + expect(client.port).to eq(443) |
139 | 139 | end
|
140 | 140 |
|
141 | 141 | it 'should override port if "use_tls" option set but a different port is specified' do
|
|
147 | 147 | expect(client.port).to eq(8443)
|
148 | 148 | end
|
149 | 149 |
|
| 150 | + it 'should override port if "use_tls" option set but a different port is specified' do |
| 151 | + client = Pusher::Client.new({ |
| 152 | + :use_tls => false, |
| 153 | + :port => 8000 |
| 154 | + }) |
| 155 | + expect(client.scheme).to eq('http') |
| 156 | + expect(client.port).to eq(8000) |
| 157 | + end |
| 158 | + |
150 | 159 | end
|
151 | 160 |
|
152 | 161 | describe 'configuring a http proxy' do
|
|
535 | 544 |
|
536 | 545 | let(:call_api) { @client.send(verb, '/path') }
|
537 | 546 |
|
538 |
| - it "should use http by default" do |
| 547 | + it "should use https by default" do |
539 | 548 | call_api
|
540 |
| - expect(WebMock).to have_requested(verb, %r{http://api-mt1.pusher.com/apps/20/path}) |
| 549 | + expect(WebMock).to have_requested(verb, %r{https://api-mt1.pusher.com/apps/20/path}) |
541 | 550 | end
|
542 | 551 |
|
543 | 552 | it "should use https if configured" do
|
544 |
| - @client.encrypted = true |
| 553 | + @client.encrypted = false |
545 | 554 | call_api
|
546 |
| - expect(WebMock).to have_requested(verb, %r{https://api-mt1.pusher.com}) |
| 555 | + expect(WebMock).to have_requested(verb, %r{http://api-mt1.pusher.com}) |
547 | 556 | end
|
548 | 557 |
|
549 | 558 | it "should format the respose hash with symbols at first level" do
|
|
622 | 631 | }
|
623 | 632 | }
|
624 | 633 |
|
625 |
| - it "should use http by default" do |
| 634 | + it "should use https by default" do |
626 | 635 | call_api
|
627 |
| - expect(WebMock).to have_requested(verb, %r{http://api-mt1.pusher.com/apps/20/path}) |
| 636 | + expect(WebMock).to have_requested(verb, %r{https://api-mt1.pusher.com/apps/20/path}) |
628 | 637 | end
|
629 | 638 |
|
630 |
| - it "should use https if configured" do |
631 |
| - @client.encrypted = true |
| 639 | + it "should use http if configured" do |
| 640 | + @client.encrypted = false |
632 | 641 | call_api
|
633 |
| - expect(WebMock).to have_requested(verb, %r{https://api-mt1.pusher.com}) |
| 642 | + expect(WebMock).to have_requested(verb, %r{http://api-mt1.pusher.com}) |
634 | 643 | end
|
635 | 644 |
|
636 | 645 | # Note that the raw httpclient connection object is returned and
|
|
657 | 666 |
|
658 | 667 | let(:call_api) { @client.send(method, '/path') }
|
659 | 668 |
|
660 |
| - it "should use http by default" do |
| 669 | + it "should use https by default" do |
661 | 670 | EM.run {
|
662 | 671 | call_api.callback {
|
663 |
| - expect(WebMock).to have_requested(verb, %r{http://api-mt1.pusher.com/apps/20/path}) |
| 672 | + expect(WebMock).to have_requested(verb, %r{https://api-mt1.pusher.com/apps/20/path}) |
664 | 673 | EM.stop
|
665 | 674 | }
|
666 | 675 | }
|
667 | 676 | end
|
668 | 677 |
|
669 |
| - it "should use https if configured" do |
| 678 | + it "should use http if configured" do |
670 | 679 | EM.run {
|
671 |
| - @client.encrypted = true |
| 680 | + @client.encrypted = false |
672 | 681 | call_api.callback {
|
673 |
| - expect(WebMock).to have_requested(verb, %r{https://api-mt1.pusher.com}) |
| 682 | + expect(WebMock).to have_requested(verb, %r{http://api-mt1.pusher.com}) |
674 | 683 | EM.stop
|
675 | 684 | }
|
676 | 685 | }
|
|
0 commit comments