Skip to content

Commit c472f33

Browse files
author
vitalie
committed
Upgrade gem rspec
1 parent e96bbe8 commit c472f33

File tree

4 files changed

+33
-28
lines changed

4 files changed

+33
-28
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ gem 'jemalloc', git: 'https://github.com/travis-ci/jemalloc-rb', branch:
2525

2626
group :development, :test do
2727
gem 'pry'
28-
gem 'rspec', '~> 2.9'
28+
gem 'rspec'
2929
end
3030

3131
group :development do

Gemfile.lock

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ GEM
2727
coderay (1.1.2)
2828
concurrent-ruby (1.0.5)
2929
connection_pool (2.2.1)
30-
diff-lcs (1.3)
30+
diff-lcs (1.5.0)
3131
faraday (0.15.0)
3232
multipart-post (>= 1.2, < 3)
3333
foreman (0.41.0)
@@ -62,14 +62,19 @@ GEM
6262
redis (3.3.5)
6363
redis-namespace (1.6.0)
6464
redis (>= 3.0.4)
65-
rspec (2.99.0)
66-
rspec-core (~> 2.99.0)
67-
rspec-expectations (~> 2.99.0)
68-
rspec-mocks (~> 2.99.0)
69-
rspec-core (2.99.2)
70-
rspec-expectations (2.99.2)
71-
diff-lcs (>= 1.1.3, < 2.0)
72-
rspec-mocks (2.99.4)
65+
rspec (3.12.0)
66+
rspec-core (~> 3.12.0)
67+
rspec-expectations (~> 3.12.0)
68+
rspec-mocks (~> 3.12.0)
69+
rspec-core (3.12.2)
70+
rspec-support (~> 3.12.0)
71+
rspec-expectations (3.12.3)
72+
diff-lcs (>= 1.2.0, < 2.0)
73+
rspec-support (~> 3.12.0)
74+
rspec-mocks (3.12.6)
75+
diff-lcs (>= 1.2.0, < 2.0)
76+
rspec-support (~> 3.12.0)
77+
rspec-support (3.12.1)
7378
sentry-raven (2.7.3)
7479
faraday (>= 0.7.6, < 1.0)
7580
sidekiq (4.0.2)
@@ -105,7 +110,7 @@ DEPENDENCIES
105110
rack-test
106111
rake (~> 12.3.3)
107112
redis-namespace
108-
rspec (~> 2.9)
113+
rspec
109114
sentry-raven
110115
sidekiq (~> 4.0.0)
111116
sinatra (~> 2.0.3)

spec/travis/app_spec.rb renamed to spec/travis/listener/app_spec.rb

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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
114114
end
File renamed without changes.

0 commit comments

Comments
 (0)