Sha256: bb7a927af049071d157c2544cbced66a3f6eb5dba1acb91d1ed2d3368fba9432

Contents?: true

Size: 752 Bytes

Versions: 2

Compression:

Stored size: 752 Bytes

Contents

require 'spec_helper'

describe Admin::SchoolsController do
  let(:admin) { Factory.create(:user_user_admin) }
  let(:school) { Factory.create :school }
  
  describe "DELETE :destroy" do
    context "school has a user" do
      login_scitent_admin

      before do
        Factory :profile, :school => school
      end

      it "does not delete the school when it is tied to a profile" do
        delete :destroy, :id => school.id
        assigns(:school).should_not be_destroyed
      end
    end
    
    context "school has no user" do
      login_scitent_admin

      it "does delete the school when it is not tied to a profile" do
        delete :destroy, :id => school.id
        assigns(:school).should be_destroyed
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scidea-schools-1.1 spec/controllers/admin/schools_controller_spec.rb
scidea-schools-1.0.6 spec/controllers/admin/schools_controller_spec.rb