Sha256: 6d0d568a2cd661014af07d55692af93dcd447eafd5b26e0c8aa6f37dba63a569
Contents?: true
Size: 989 Bytes
Versions: 7
Compression:
Stored size: 989 Bytes
Contents
require 'spec_helper' describe SchoolsController do let(:user) { Factory.create(:user) } let(:admin) { Factory.create(:user_user_admin) } let(:school) { mock_model(School).as_null_object } describe "create" do context "logged in as admin" do login_scitent_admin before do School.stub(:new).and_return(school) end it "assigns a school" do post :create, :id => "123" assigns[:school].should eq(school) end it "calls approved=true" do school.should_receive(:approved=).with(true) post :create, :id => "123" end end context "not logged in" do before do School.stub(:new).and_return(school) end it "assigns a school" do post :create, :id => "123" assigns[:school].should eq(school) end it "calls approved=false" do school.should_receive(:approved=).with(nil) post :create, :id => "123" end end end end
Version data entries
7 entries across 7 versions & 1 rubygems