Sha256: 02885a5ce7bd92dba37bf9bfa0d0f2c7cc642e7d6218a5ef7838604bd3521466
Contents?: true
Size: 1.09 KB
Versions: 4
Compression:
Stored size: 1.09 KB
Contents
module ControllerMacros def self.included(base) base.extend(ClassMethods) end module ClassMethods def it_should_require_login_for_actions(*actions) actions.each do |action| it "#{action} should redirect if no user signed in" do get action response.should_not be_success end end end def it_should_redirect_to_app_main_for_actions(*actions) actions.each do |action| it "#{action} should redirect if no user signed in" do get action response.should redirect_to IuguSDK::app_main_url end end end def login_as_user before(:each) do @request.env["devise.mapping"] = Devise.mappings[:user] user = @user if @user if user.nil? user = Fabricate(:user, :email => "teste@teste.com", :password => "123456", :password_confirmation => "123456" ) @user = user end account = Fabricate(:account) account.account_users << Fabricate(:account_user, :user => user) sign_in user set_account user end end end end
Version data entries
4 entries across 4 versions & 1 rubygems