-
-
Save bnferguson/5f1f968b93e028aaf210 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "as a superuser" do | |
before(:each) do | |
@superuser = mock_model(Person, :business => @business).as_null_object | |
@superuser.stub!(:any_role?).and_return(true) | |
@superuser.stub!(:is_superuser?).and_return(true) | |
@superuser.stub!(:must_agree_to_policy?).and_return(false) | |
controller.stub!(:current_person).and_return(@superuser) | |
end | |
describe "in non-production environments" do | |
before(:each) do | |
controller.stub!(:production?).and_return(false) | |
end | |
it "assigns business" do | |
do_action | |
assigns(:business).should be_a_kind_of(Business) | |
end | |
%W(lines people groups bill_imports carrier_accounts business_plans custom_carrier_plans imports surveys activities notes notifications business_ref_devices faqs).each do |removable| | |
before(:each) do | |
# ActiveRecord doesn't need to be tested here. | |
@business.send(removable).stub!(:destroy_all).and_return(true) | |
end | |
it "removes #{removable} if found in params" do | |
@params[removable.to_sym] = true | |
@business.send(removable).should_receive(:destroy_all) | |
do_action | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment