Sha256: 2012bea66416283725d4bf50975d7152779ca2f06d632656fe5f81c6916d4dcd
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 KB
Contents
require 'test_setup' class CurrentUserTest < MiniTest::Unit::TestCase include IntercomRails DUMMY_USER = dummy_user(:email => 'ciaran@intercom.io', :name => 'Ciaran Lee') def test_raises_error_when_no_user_found assert_raises(IntercomRails::CurrentUserNotFoundError) { CurrentUser.new(Object.new) } end def test_finds_current_user object_with_current_user_method = Object.new object_with_current_user_method.instance_eval do def current_user DUMMY_USER end end @current_user = CurrentUser.new(object_with_current_user_method) assert_user_found end def test_finds_user_instance_variable object_with_instance_variable = Object.new object_with_instance_variable.instance_eval do @user = DUMMY_USER end @current_user = CurrentUser.new(object_with_instance_variable) assert_user_found end def test_finds_config_user object_from_config = Object.new object_from_config.instance_eval do def something_esoteric DUMMY_USER end end IntercomRails.config.current_user = Proc.new { something_esoteric } @current_user = CurrentUser.new(object_from_config) assert_user_found end def assert_user_found assert_equal DUMMY_USER, @current_user.user end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
intercom-rails-0.0.9 | test/intercom-rails/current_user_test.rb |