Skip to content

Commit ae4773a

Browse files
committed
Switch to the expectation syntax
Signed-off-by: David Celis <[email protected]>
1 parent 2c5bb35 commit ae4773a

File tree

2 files changed

+21
-16
lines changed

2 files changed

+21
-16
lines changed

spec/rails_spec.rb

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
context 'without enough items to give more than one page' do
66
it 'should not paginate' do
77
get :index, count: 20
8-
response.headers.keys.should_not include('Link')
8+
expect(response.headers.keys).not_to include('Link')
99
end
1010
end
1111

@@ -16,12 +16,12 @@
1616
end
1717

1818
it 'should keep existing Links' do
19-
@links.should include('<http://test.host/numbers?count=30>; rel="without"')
19+
expect(@links).to include('<http://test.host/numbers?count=30>; rel="without"')
2020
end
2121

2222
it 'should contain pagination Links' do
23-
@links.should include('<http://test.host/numbers?count=30&page=2>; rel="next"')
24-
@links.should include('<http://test.host/numbers?count=30&page=2>; rel="last"')
23+
expect(@links).to include('<http://test.host/numbers?count=30&page=2>; rel="next"')
24+
expect(@links).to include('<http://test.host/numbers?count=30&page=2>; rel="last"')
2525
end
2626
end
2727

@@ -34,19 +34,19 @@
3434
end
3535

3636
it 'should not give a link with rel "first"' do
37-
@links.should_not include('rel="first"')
37+
expect(@links).not_to include('rel="first"')
3838
end
3939

4040
it 'should not give a link with rel "prev"' do
41-
@links.should_not include('rel="prev"')
41+
expect(@links).not_to include('rel="prev"')
4242
end
4343

4444
it 'should give a link with rel "last"' do
45-
@links.should include('<http://test.host/numbers?count=100&page=4>; rel="last"')
45+
expect(@links).to include('<http://test.host/numbers?count=100&page=4>; rel="last"')
4646
end
4747

4848
it 'should give a link with rel "next"' do
49-
@links.should include('<http://test.host/numbers?count=100&page=2>; rel="next"')
49+
expect(@links).to include('<http://test.host/numbers?count=100&page=2>; rel="next"')
5050
end
5151
end
5252

@@ -58,19 +58,19 @@
5858
end
5959

6060
it 'should not give a link with rel "last"' do
61-
@links.should_not include('rel="last"')
61+
expect(@links).not_to include('rel="last"')
6262
end
6363

6464
it 'should not give a link with rel "next"' do
65-
@links.should_not include('rel="next"')
65+
expect(@links).not_to include('rel="next"')
6666
end
6767

6868
it 'should give a link with rel "first"' do
69-
@links.should include('<http://test.host/numbers?count=100&page=1>; rel="first"')
69+
expect(@links).to include('<http://test.host/numbers?count=100&page=1>; rel="first"')
7070
end
7171

7272
it 'should give a link with rel "prev"' do
73-
@links.should include('<http://test.host/numbers?count=100&page=3>; rel="prev"')
73+
expect(@links).to include('<http://test.host/numbers?count=100&page=3>; rel="prev"')
7474
end
7575
end
7676

@@ -80,10 +80,10 @@
8080

8181
links = response.headers['Link'].split(', ')
8282

83-
links.should include('<http://test.host/numbers?count=100&page=1>; rel="first"')
84-
links.should include('<http://test.host/numbers?count=100&page=4>; rel="last"')
85-
links.should include('<http://test.host/numbers?count=100&page=3>; rel="next"')
86-
links.should include('<http://test.host/numbers?count=100&page=1>; rel="prev"')
83+
expect(links).to include('<http://test.host/numbers?count=100&page=1>; rel="first"')
84+
expect(links).to include('<http://test.host/numbers?count=100&page=4>; rel="last"')
85+
expect(links).to include('<http://test.host/numbers?count=100&page=3>; rel="next"')
86+
expect(links).to include('<http://test.host/numbers?count=100&page=1>; rel="prev"')
8787
end
8888
end
8989
end

spec/spec_helper.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ def last_page?() current_page == total_pages end
1515
end
1616

1717
RSpec.configure do |config|
18+
# Disable the 'should' syntax.
19+
config.expect_with :rspec do |c|
20+
c.syntax = :expect
21+
end
22+
1823
# Run specs in random order to surface order dependencies. If you find an
1924
# order dependency and want to debug it, you can fix the order by providing
2025
# the seed, which is printed after each run.

0 commit comments

Comments
 (0)