Sha256: c1682a2165106d4f31a3c134d522820f22d69a66a457a467e4c333970cd8cabb

Contents?: true

Size: 971 Bytes

Versions: 2

Compression:

Stored size: 971 Bytes

Contents

require 'test_helper'

describe Clever::NestedResource, :vcr do
  before do
    Clever.configure do |config|
      config.token = 'DEMO_TOKEN'
    end
  end

  [Clever::District, Clever::School, Clever::Student,
   Clever::Event, Clever::Section, Clever::Teacher].each do |resource|
    next if resource.linked_resources.nil?
    resource.linked_resources.each do |link|
      it "retrieves a #{resource.shortname}'s #{link}" do
        result = resource.find.first.send link
        if Clever::Util.singular?(link.to_s)
          result.must_be_instance_of Clever::APIResource.named(link.to_s)
        else
          result.must_be_instance_of Clever::NestedResource
          result.size.must_equal result.count # check count request measures actual data size
        end
      end
    end
  end

  it 'must include auth_token in linked_resources' do
    school = Clever::District.find.first.send(:schools).first
    school.auth_token.must_equal 'DEMO_TOKEN'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
clever-ruby-0.11.1 test/integration/nested_resource_test.rb
clever-ruby-0.11.0 test/integration/nested_resource_test.rb