spec/acfs/collection_spec.rb in acfs-0.43.1 vs spec/acfs/collection_spec.rb in acfs-0.43.2

- old
+ new

@@ -11,38 +11,50 @@ context 'without explicit page parameter' do before do stub_request(:get, 'http://users.example.org/users') .to_return response([{id: 1, name: 'Anon', age: 12, born_at: 'Berlin'}], - headers: {'X-Total-Pages' => '2'}) + headers: { + 'X-Total-Pages' => '2', + 'X-Total-Count' => '10' + }) end its(:total_pages) { should eq 2 } its(:current_page) { should eq 1 } + its(:total_count) { should eq 10 } end context 'with page parameter' do let(:params) { {page: 2} } before do stub_request(:get, 'http://users.example.org/users?page=2') .to_return response([{id: 1, name: 'Anon', age: 12, born_at: 'Berlin'}], - headers: {'X-Total-Pages' => '2'}) + headers: { + 'X-Total-Pages' => '2', + 'X-Total-Count' => '10' + }) end its(:total_pages) { should eq 2 } its(:current_page) { should eq 2 } + its(:total_count) { should eq 10 } end context 'with non-numerical page parameter' do let(:params) { {page: 'e546f5'} } before do stub_request(:get, 'http://users.example.org/users?page=e546f5') .to_return response([{id: 1, name: 'Anon', age: 12, born_at: 'Berlin'}], - headers: {'X-Total-Pages' => '2'}) + headers: { + 'X-Total-Pages' => '2', + 'X-Total-Count' => '10' + }) end its(:total_pages) { should eq 2 } its(:current_page) { should eq 'e546f5' } + its(:total_count) { should eq 10 } end describe '#next_page' do before do stub_request(:get, 'http://users.example.org/users')