Magent should use the same settings as mongomapper, app config should load first, websocket spec is a little better.
This commit is contained in:
parent
14ad24ba7e
commit
60e29f6572
4 changed files with 12 additions and 5 deletions
|
|
@ -11,6 +11,8 @@ development:
|
|||
socket_port: 8080
|
||||
socket_collection_name: 'websocket'
|
||||
pubsub_server: 'https://pubsubhubbub.appspot.com/'
|
||||
mongo_host: 'localhost'
|
||||
mongo_post: 27017
|
||||
|
||||
test:
|
||||
debug: false
|
||||
|
|
@ -18,6 +20,8 @@ test:
|
|||
socket_host: 0.0.0.0
|
||||
socket_port: 8081
|
||||
pubsub_server: 'https://pubsubhubbub.appspot.com/'
|
||||
mongo_host: 'localhost'
|
||||
mongo_post: 27017
|
||||
|
||||
production:
|
||||
debug: false
|
||||
|
|
@ -25,3 +29,5 @@ production:
|
|||
socket_host: 0.0.0.0
|
||||
socket_port: 8080
|
||||
pubsub_server: 'https://pubsubhubbub.appspot.com/'
|
||||
mongo_host: 'localhost'
|
||||
mongo_post: 27017
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
if ENV['MONGOHQ_URL']
|
||||
MongoMapper.config = {RAILS_ENV => {'uri' => ENV['MONGOHQ_URL']}}
|
||||
else
|
||||
MongoMapper.connection = Mongo::Connection.new('localhost', 27017)
|
||||
MongoMapper.connection = Mongo::Connection.new(APP_CONFIG['mongo_host'], APP_CONFIG['mongo_port'])
|
||||
end
|
||||
|
||||
MongoMapper.database = "diaspora-#{Rails.env}"
|
||||
|
|
@ -16,3 +16,4 @@ if defined?(PhusionPassenger)
|
|||
end
|
||||
end
|
||||
|
||||
Magent.connection = Mongo::Connection.new(APP_CONFIG['mongo_host'], APP_CONFIG['mongo_port'])
|
||||
|
|
|
|||
|
|
@ -19,18 +19,18 @@ describe Diaspora::WebSocket do
|
|||
|
||||
describe 'queuing and dequeuing ' do
|
||||
before do
|
||||
@post.socket_to_uid(@user.id, :aspect_ids => @aspect.id)
|
||||
@channel = Magent::GenericChannel.new('websocket')
|
||||
@messages = @channel.message_count
|
||||
@post.socket_to_uid(@user.id, :aspect_ids => @aspect.id)
|
||||
end
|
||||
|
||||
it 'should send the queued job to Magent' do
|
||||
@channel.message_count.should == 1
|
||||
@channel.message_count.should == @messages + 1
|
||||
end
|
||||
|
||||
it 'should dequeue the job successfully' do
|
||||
messages = @channel.message_count
|
||||
@channel.dequeue
|
||||
@channel.message_count.should == messages -1
|
||||
@channel.message_count.should == @messages
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue