diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c1fa683 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,30 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + matrix: + ruby-version: + - '3.4' + + steps: + - uses: actions/checkout@v4 + + - name: set up ruby ${{ matrix.ruby-version }} + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true + + - name: rspec + run: bundle exec rspec diff --git a/spec/client_spec.rb b/spec/client_spec.rb index 5447711..3ff75f6 100644 --- a/spec/client_spec.rb +++ b/spec/client_spec.rb @@ -338,6 +338,7 @@ mock_request(OneRoster::CLASSES_ENDPOINT, classes_response) mock_request(OneRoster::COURSES_ENDPOINT, courses_response) mock_request(OneRoster::ACADEMIC_SESSIONS_ENDPOINT, terms_response) + mock_request(OneRoster::SCHOOLS_ENDPOINT, schools_response) end context 'without course_codes passed in' do @@ -355,8 +356,8 @@ expect(first_classroom.course_number).to eq(course_1['courseCode']) expect(first_classroom.period).to eq('1') expect(first_classroom.grades).to eq(class_1['grades']) - expect(first_classroom.tenant_id).to eq(class_1['tenant_id']) - expect(first_classroom.school_id).to eq(class_1['school_id']) + expect(first_classroom.tenant_id).to eq(school_1.dig('parent', 'sourcedId')) + expect(first_classroom.school_uid).to eq(class_1.dig('school', 'sourcedId')) expect(first_classroom.subjects).to eq([]) expect(first_classroom.term_name).to eq('term name') expect(first_classroom.term_start_date).to eq('2019-08-21') diff --git a/spec/support/api_responses.rb b/spec/support/api_responses.rb index 38ca371..095082f 100644 --- a/spec/support/api_responses.rb +++ b/spec/support/api_responses.rb @@ -253,8 +253,7 @@ 'grades' => %w(04 05), 'junk' => 'data', 'terms' => [{ 'sourcedId' => '1' }], - 'tenant_id' => 'tenant_id', - 'school_id' => 'school_id' + 'school' => { 'sourcedId' => 'school_id' } } end @@ -344,6 +343,22 @@ OneRoster::Response.new(stub(body: courses_body, status: status, env: stub(url: courses_response_url), headers: {})) end + #################################### SCHOOLS RESPONSE ##################################### + let(:school_1) do + { + 'sourcedId' => 'school_id', + 'name' => 'Test School', + 'identifier' => 'TS001', + 'parent' => { 'sourcedId' => 'tenant_id' } + } + end + + let(:schools_response_url) { stub(path: OneRoster::SCHOOLS_ENDPOINT) } + let(:schools_body) { { 'orgs' => [school_1] } } + let(:schools_response) do + OneRoster::Response.new(stub(body: schools_body, status: status, env: stub(url: schools_response_url), headers: {})) + end + ################################### PAGINATION RESPONSE ################################### let(:page_1_response) do OneRoster::Response.new(