Sha256: 93d662f6eec296aa83bc4602dbbfc9c63924c5fb4627889c1e57d0071aa0d5f4
Contents?: true
Size: 1.51 KB
Versions: 2
Compression:
Stored size: 1.51 KB
Contents
require 'test_helper' describe 'last method', :vcr do before do Clever.configure do |config| config.token = 'DEMO_TOKEN' end end resources = [Clever::District, Clever::School, Clever::Student, Clever::Event, Clever::Section, Clever::Teacher] describe 'page' do it 'has working first and last methods' do resources.each do |resource| page = Clever::APIOperations::Page.new resource.url list = page.all page.first.must_equal list.first page.last.must_equal list.last page.first(10).must_equal list.first(10) page.last(10).must_equal list.last(10) end end end describe 'nested resource' do it 'has working first and last methods' do resources.each do |resource| resource.linked_resources do |l| nested = resource.first.send l nested_resource = Clever::APIResource.named l if Clever::Util.singular? l nested.first.must_be_instance_of nested_resource else nested.first.must_be_instance_of nested_resource nested.first(10).each do |e| e.must_be_intsance_of nested_resource end last = nested.last last.must_be_instance_of nested_resource count = 0 nested.last(10).each do |e| e.must_be_intsance_of nested_resource e.must_equal last if count == 19 count += 1 end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
clever-ruby-0.11.1 | test/integration/last_test.rb |
clever-ruby-0.11.0 | test/integration/last_test.rb |