spec/lockdown/frameworks/rails/controller_spec.rb in lockdown-0.8.1 vs spec/lockdown/frameworks/rails/controller_spec.rb in lockdown-0.9.0
- old
+ new
@@ -62,17 +62,18 @@
@controller.configure_lockdown
end
end
describe "#set_current_user" do
- it "should set the profile_id in Thread.current" do
+ it "should set who_did_it in Thread.current" do
+ Lockdown::System.stub!(:fetch).with(:who_did_it).and_return(:current_user_id)
@controller.stub!(:logged_in?).and_return(true)
- @controller.stub!(:current_profile_id).and_return(1234)
+ @controller.stub!(:current_user_id).and_return(1234)
@controller.set_current_user
- Thread.current[:profile_id].should == 1234
+ Thread.current[:who_did_it].should == 1234
end
end
describe "#check_request_authorization" do
it "should raise SecurityError if not authorized" do
@@ -204,11 +205,13 @@
@controller.should_receive(:redirect_to).with("/")
@controller.redirect_back_or_default("/")
end
it "should redirect to session[:prevpage]" do
- @session[:prevpage] = "/previous"
- @controller.should_receive(:redirect_to).with("/previous")
+ path = "/previous"
+ path.stub!(:blank?).and_return(false)
+ @session[:prevpage] = path
+ @controller.should_receive(:redirect_to).with(path)
@controller.redirect_back_or_default("/")
end
end
describe "#login_from_basic_auth?" do