34 lines
832 B
Ruby
34 lines
832 B
Ruby
require 'spec_helper'
|
|
|
|
describe ApiSchoolsController, type: :controller, skip: "Feature not supported" do
|
|
render_views
|
|
|
|
let (:owner) {FactoryBot.create(:user)}
|
|
let (:school) {FactoryBot.create(:school, user: owner)}
|
|
|
|
before(:each) do
|
|
controller.current_user = owner
|
|
end
|
|
|
|
describe "show" do
|
|
it "works" do
|
|
get :show, params: { id: school.id }
|
|
response.should be_successful
|
|
JSON.parse(response.body)['id'].should eql school.id
|
|
end
|
|
|
|
end
|
|
|
|
describe "update" do
|
|
|
|
it "works" do
|
|
post :update, params: { id: school.id, name: "Hardy har", scheduling_communication: 'school', format: 'json' }
|
|
response.should be_successful
|
|
json = JSON.parse(response.body)
|
|
json['name'].should eql "Hardy har"
|
|
json['scheduling_communication'].should eql 'school'
|
|
end
|
|
|
|
end
|
|
end
|