Sha256: bbfd24c059879c6cb8b6d419dc7569fd4a40a4d252ef71ccf7c456ac2352893a
Contents?: true
Size: 1.72 KB
Versions: 13
Compression:
Stored size: 1.72 KB
Contents
require "spec_helper" module CloudSesame module Query module Node describe Page do let(:node) { Page.new(arguments) } describe '#initialize' do context 'when arguments passed in' do let(:arguments) { { page: 2, size: 13 } } it 'should initialize the page with the page argument' do expect(node.page).to eq 1 end it 'should initialize the size with the size argument' do expect(node.size).to eq 13 end end context 'when arguments NOT passed in' do let(:arguments) { {} } it 'should default the page to 1' do expect(node.page).to eq 1 end it 'should default the size to 10' do expect(node.size).to eq 10 end end end describe 'start' do [{ page: 1, size: 100, expect_start: 0 }, { page: 2, size: 10, expect_start: 10 }, { page: 3, size: 13, expect_start: 26 }].each do |arguments| it 'should calculate and return the starting point' do node = Page.new(size: arguments[:size]) node.page = arguments[:page] expect(node.start).to eq arguments[:expect_start] end end end describe '#run' do let(:arguments) { { page: 3, size: 13 } } it 'should return the calculated start' do expect(node.compile).to include start: node.start end it 'should return the size' do expect(node.compile).to include size: arguments[:size] end end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems