require 'spec_helper'

describe ApiSchoolsController, type: :controller do
  render_views

  let (:owner) {FactoryGirl.create(:user)}
  let (:school) {FactoryGirl.create(:school, user: owner)}

  before(:each) do
    controller.current_user = owner
  end

  describe "show" do
    it "works" do
      get :show, id: school.id
      response.should be_success
      JSON.parse(response.body)['id'].should eql school.id
    end

  end

  describe "update" do

    it "works" do
      post :update, id: school.id, name: "Hardy har", scheduling_communication: 'school', format: 'json'
      response.should be_success
      json = JSON.parse(response.body)
      json['name'].should eql "Hardy har"
      json['scheduling_communication'].should eql 'school'
    end

  end
end
