Deal with ids from PG coming out as strings

This commit is contained in:
Raphael Sofaer 2011-06-16 06:36:43 +02:00
parent 2d3eeb9c46
commit c12103aed9
2 changed files with 7 additions and 1 deletions

View file

@ -302,7 +302,9 @@ describe Postzord::Dispatch do
it 'should call object#socket_to_user for each local user' do
sc = mock()
SocketsController.should_receive(:new).and_return(sc)
sc.should_receive(:outgoing).with(bob, @zord.instance_variable_get(:@object), :aspect_ids => bob.contact_for(alice.person).aspect_memberships.map{|a| a.aspect_id})
sc.should_receive(:outgoing).with(bob,
@zord.instance_variable_get(:@object),
:aspect_ids => bob.contact_for(alice.person).aspect_memberships.map{|a| postgres? ? a.aspect_id.to_s : a.aspect_id })
@zord.send(:socket_and_notify_users, [bob])
end

View file

@ -83,3 +83,7 @@ end
def photo_fixture_name
@photo_fixture_name = File.join(File.dirname(__FILE__), 'fixtures', 'button.png')
end
def postgres?
defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) && ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
end