Sha256: 262195922d8d9cf97c7430418b97ca6ec8548b9e1f938c44ae41dc479e21df51
Contents?: true
Size: 842 Bytes
Versions: 3
Compression:
Stored size: 842 Bytes
Contents
module OdaniaTestMock mattr_accessor :signed_in @@signed_in = false mattr_accessor :mock_current_user def self.current_user @@mock_current_user ||= Odania::User.find_or_create_by(name: 'Admin') end mattr_accessor :user_authenticated @@user_authenticated = false def self.enqueue(background_type, opts) puts "Enqueued for background processing: #{background_type} with options: #{opts}" end end module UserAuthHelper def user_auth(opts) return redirect_to '/' unless user_signed_in? end end ActiveSupport.on_load(:action_controller) do include UserAuthHelper end Odania.setup do |config| config.user_signed_in_function = 'OdaniaTestMock.signed_in' config.current_user_function = 'OdaniaTestMock.current_user' config.authenticate_user_function = 'user_auth' config.background_enqueue = 'OdaniaTestMock.enqueue' end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
odania_core-0.0.3 | test/support/test_setup.rb |
odania_core-0.0.2 | test/support/test_setup.rb |
odania_core-0.0.1 | test/support/test_setup.rb |