spec/acfs/stub_spec.rb in acfs-0.33.1.1.b281 vs spec/acfs/stub_spec.rb in acfs-0.33.1.1.b285
- old
+ new
@@ -152,9 +152,23 @@
expect(computers.first).to be_a PC
expect(computers.last).to be_a Mac
end
end
+
+ context 'with header' do
+ before do
+ Acfs::Stub.resource Comment, :list,
+ return: [{ id: 1, text: 'Foo' }, { id: 2, text: 'Bar' }],
+ headers: headers
+ end
+
+ let!(:comments) { Comment.all }
+ let(:headers) { {'X-Total-Pages' => '2'} }
+ subject { Acfs.run; comments }
+
+ its(:total_pages) { should eq 2 }
+ end
end
context 'with update action' do
before do
Acfs::Stub.resource MyUser, :read, with: { id: 1 }, return: { id: 1, name: 'John Smith', age: 32 }