Sha256: 34fb4cd7af1b10c309983c9e64808695a1e88ccd48833a691d2eee29b45aa46f

Contents?: true

Size: 1.49 KB

Versions: 5

Compression:

Stored size: 1.49 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))

describe GreatSchools::District do
  describe '#browse' do
    it 'should populate district models from the returned XML' do
      xml = File.read(File.expand_path(
        File.join(File.dirname(__FILE__), '..', 'fixtures', 'browse_districts.xml')
      ))
      FakeWeb.register_uri(:get, 'http://api.greatschools.org/districts/CA/San-Francisco?key=0123456789ABCDEF', body: xml)

      districts = GreatSchools::District.browse('CA', 'San Francisco')

      districts.size.should eql(2)
      districts[0].name.should eql('San Francisco Unified School District')
      districts[1].name.should eql('San Francisco County Office of Education')

      district = districts.first
      district.name.should eql('San Francisco Unified School District')
      district.nces_code.should eql('0634410')
      district.district_rating.should eql('6')
      district.address.should eql('555 Franklin St., San Francisco, CA 94102')
      district.phone.should eql('(415) 241-6000')
      district.fax.should eql('(415) 241-6012')
      district.website.should eql('http://www.sfusd.k12.ca.us')
      district.grade_range.should eql('K-12 & ungraded')
      district.total_schools.should eql('121')
      district.elementary_schools.should eql('84')
      district.middle_schools.should eql('36')
      district.high_schools.should eql('34')
      district.public_schools.should eql('113')
      district.charter_schools.should eql('8')
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
great_schools-0.2.1 spec/great_schools/district_spec.rb
great_schools-0.2.0 spec/great_schools/district_spec.rb
great_schools-0.1.2 spec/great_schools/district_spec.rb
great_schools-0.1.1 spec/great_schools/district_spec.rb
great_schools-0.1.0 spec/great_schools/district_spec.rb