@@ -27,20 +27,20 @@ def create(opts = {})
2727
2828 it 'results in a 204 if the hook is accepted' do
2929 create
30- last_response . status . should be == 204
30+ expect ( last_response . status ) . to be ( 204 )
3131 end
3232
3333 describe 'without a payload' do
3434 let ( :payload ) { nil }
3535 it 'does not accept a hook' do
3636 create
37- last_response . status . should be == 422
37+ expect ( last_response . status ) . to be ( 422 )
3838 end
3939 end
4040
4141 it 'returns 200 when checking if the app is still running' do
4242 get '/uptime'
43- last_response . status . should be == 200
43+ expect ( last_response . status ) . to be ( 200 )
4444 end
4545
4646 it "should push the message to sidekiq" do
@@ -55,60 +55,60 @@ def create(opts = {})
5555
5656 context "with valid_ips provided" do
5757 before do
58- described_class . any_instance . stub ( :valid_ips ) . and_return ( [ '1.2.3.4' ] )
58+ allow_any_instance_of ( described_class ) . to receive ( :valid_ips ) . and_return ( [ '1.2.3.4' ] )
5959 end
6060
6161 context "when ip_validation is turned off" do
6262 it 'accepts a request from an invalid IP' do
63- described_class . any_instance . should_receive ( :report_ip_validity )
63+ expect_any_instance_of ( described_class ) . to receive ( :report_ip_validity )
6464 create headers : { 'REMOTE_ADDR' => '1.2.3.1' }
65- last_response . status . should be == 204
65+ expect ( last_response . status ) . to be ( 204 )
6666 end
6767 end
6868
6969 context "when ip_validation is turned on" do
7070 before do
71- described_class . any_instance . stub ( :ip_validation? ) . and_return ( true )
71+ allow_any_instance_of ( described_class ) . to receive ( :ip_validation? ) . and_return ( true )
7272 end
7373
7474 it 'accepts a request from valid IP' do
7575 create headers : { 'REMOTE_ADDR' => '1.2.3.4' }
76- last_response . status . should be == 204
76+ expect ( last_response . status ) . to be ( 204 )
7777 end
7878
7979 it 'rejects a request without a valid IP' do
8080 create headers : { 'REMOTE_ADDR' => '1.1.1.1' }
81- last_response . status . should be == 403
81+ expect ( last_response . status ) . to be ( 403 )
8282 end
8383 end
8484 end
8585
8686 context 'with valid_ips provided as a range' do
8787 before do
88- described_class . any_instance . stub ( :valid_ips ) . and_return ( [ '1.1.1.0/30' ] )
89- described_class . any_instance . stub ( :ip_validation? ) . and_return ( true )
88+ allow_any_instance_of ( described_class ) . to receive ( :valid_ips ) . and_return ( [ '1.1.1.0/30' ] )
89+ allow_any_instance_of ( described_class ) . to receive ( :ip_validation? ) . and_return ( true )
9090 end
9191
9292 it 'accepts a request from valid IP' do
9393 create headers : { 'REMOTE_ADDR' => '1.1.1.0' }
94- last_response . status . should be == 204
94+ expect ( last_response . status ) . to be ( 204 )
9595
9696 create headers : { 'REMOTE_ADDR' => '1.1.1.1' }
97- last_response . status . should be == 204
97+ expect ( last_response . status ) . to be ( 204 )
9898
9999 create headers : { 'REMOTE_ADDR' => '1.1.1.2' }
100- last_response . status . should be == 204
100+ expect ( last_response . status ) . to be ( 204 )
101101
102102 create headers : { 'REMOTE_ADDR' => '1.1.1.3' }
103- last_response . status . should be == 204
103+ expect ( last_response . status ) . to be ( 204 )
104104 end
105105
106106 it 'rejects a request without a valid IP' do
107107 create headers : { 'REMOTE_ADDR' => '1.1.1.4' }
108- last_response . status . should be == 403
108+ expect ( last_response . status ) . to be ( 403 )
109109
110110 create headers : { 'REMOTE_ADDR' => '1.1.1.10' }
111- last_response . status . should be == 403
111+ expect ( last_response . status ) . to be ( 403 )
112112 end
113113 end
114114end
0 commit comments