From 9742f5f0b24a6acdb82bccdd2b5baf78a84c6c21 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 14 Oct 2014 01:58:21 +0200 Subject: [PATCH] Fixed unit tests. --- lib/sessions.rb | 2 +- lib/sessions/client.rb | 4 ++-- test/unit/session_enhanced_test.rb | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/sessions.rb b/lib/sessions.rb index 86b83c41b..925b2eef2 100644 --- a/lib/sessions.rb +++ b/lib/sessions.rb @@ -479,7 +479,7 @@ returns next if !session_data next if !session_data[:user] next if !session_data[:user]['id'] - user = User.lookup( session_data[:user]['id'] ) + user = User.lookup( :id => session_data[:user]['id'] ) next if !user # start client thread diff --git a/lib/sessions/client.rb b/lib/sessions/client.rb index a0c866517..24bb832f1 100644 --- a/lib/sessions/client.rb +++ b/lib/sessions/client.rb @@ -27,8 +27,8 @@ class Sessions::Client session_data = Sessions.get( @client_id ) return if !session_data return if !session_data[:user] - return if !session_data[:user][:id] - user = User.lookup( :id => session_data[:user][:id] ) + return if !session_data[:user]['id'] + user = User.lookup( :id => session_data[:user]['id'] ) return if !user # init new backends diff --git a/test/unit/session_enhanced_test.rb b/test/unit/session_enhanced_test.rb index a40410e9c..18f96c7db 100644 --- a/test/unit/session_enhanced_test.rb +++ b/test/unit/session_enhanced_test.rb @@ -83,17 +83,17 @@ class SessionEnhancedTest < ActiveSupport::TestCase data = Sessions.get(client_id1) assert( data[:meta], "check if meta exists" ) assert( data[:user], "check if user exists" ) - assert_equal( data[:user][:id], agent1.id, "check if user id is correct" ) + assert_equal( data[:user]['id'], agent1.id, "check if user id is correct" ) data = Sessions.get(client_id2) assert( data[:meta], "check if meta exists" ) assert( data[:user], "check if user exists" ) - assert_equal( data[:user][:id], agent2.id, "check if user id is correct" ) + assert_equal( data[:user]['id'], agent2.id, "check if user id is correct" ) data = Sessions.get(client_id3) assert( data[:meta], "check if meta exists" ) assert( data[:user], "check if user exists" ) - assert_equal( data[:user][:id], agent3.id, "check if user id is correct" ) + assert_equal( data[:user]['id'], agent3.id, "check if user id is correct" ) # send data to one client Sessions.send( client_id1, { :msg => 'äöüß123' } )