em-mongo 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.3
1
+ 0.3.4
@@ -237,10 +237,6 @@ module EM::Mongo
237
237
 
238
238
  end
239
239
 
240
- end
241
-
242
- module EM::Mongo
243
-
244
240
  class Connection
245
241
 
246
242
  def initialize(host = DEFAULT_IP, port = DEFAULT_PORT, timeout = nil, opts = {})
@@ -16,7 +16,7 @@ module EM::Mongo
16
16
  end
17
17
 
18
18
  def collection(name = EM::Mongo::DEFAULT_NS)
19
- @collections[@db_name] ||= EM::Mongo::Collection.new(@db_name, name, @em_connection)
19
+ @collections[name] ||= EM::Mongo::Collection.new(@db_name, name, @em_connection)
20
20
  end
21
21
 
22
22
  def connection
data/lib/em-mongo.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require "eventmachine"
1
2
  begin
2
3
  require "bson_ext"
3
4
  rescue LoadError
@@ -2,7 +2,6 @@ require File.expand_path('spec_helper', File.dirname(__FILE__) + '/../')
2
2
 
3
3
  describe EMMongo::Connection do
4
4
  include EM::Spec
5
- include EM::Mongo
6
5
 
7
6
  it 'should connect' do
8
7
  @conn = EMMongo::Connection.new
@@ -29,7 +28,7 @@ describe EMMongo::Connection do
29
28
  end
30
29
 
31
30
  it 'should reconnect' do
32
- @conn = EMMongo::Connection.new(DEFAULT_IP, DEFAULT_PORT, nil, {:reconnect_in => 0.5})
31
+ @conn = EMMongo::Connection.new(EM::Mongo::DEFAULT_IP, EM::Mongo::DEFAULT_PORT, nil, {:reconnect_in => 0.5})
33
32
  EM.add_timer(0.1) do
34
33
  @conn.close
35
34
  end
@@ -21,7 +21,17 @@ describe EMMongo::Database do
21
21
  res.should == true
22
22
  done
23
23
  end
24
- end
25
-
24
+ end
25
+
26
+ it 'should cache collections correctly' do
27
+ @conn = EM::Mongo::Connection.new
28
+ @db = @conn.db
29
+ a = @db.collection('first_collection')
30
+ b = @db.collection('second_collection')
31
+ a.should_not == b
32
+ @db.collection('first_collection').should == a
33
+ @db.collection('second_collection').should == b
34
+ done
35
+ end
26
36
 
27
37
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 3
9
- version: 0.3.3
8
+ - 4
9
+ version: 0.3.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - bcg
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-30 00:00:00 -05:00
17
+ date: 2010-12-01 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency