34 lines
738 B
Ruby
34 lines
738 B
Ruby
require 'spec_helper'
|
|
|
|
describe ApiSchoolsController 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'
|
|
response.should be_success
|
|
json = JSON.parse(response.body)
|
|
json['name'].should eql "Hardy har"
|
|
json['scheduling_communication'].should eql 'school'
|
|
end
|
|
|
|
end
|
|
end
|