Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 3 additions & 2 deletions spec/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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')
Expand Down
19 changes: 17 additions & 2 deletions spec/support/api_responses.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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(
Expand Down