em-mongo 0.3.6 → 0.4.0
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 +1 -1
- data/lib/em-mongo/collection.rb +756 -23
- data/lib/em-mongo/connection.rb +100 -95
- data/lib/em-mongo/conversions.rb +2 -2
- data/lib/em-mongo/core_ext.rb +20 -0
- data/lib/em-mongo/cursor.rb +537 -0
- data/lib/em-mongo/database.rb +348 -20
- data/lib/em-mongo/exceptions.rb +2 -2
- data/lib/em-mongo/prev.rb +53 -0
- data/lib/em-mongo/request_response.rb +34 -0
- data/lib/em-mongo/server_response.rb +32 -0
- data/lib/em-mongo/support.rb +4 -4
- data/lib/em-mongo.rb +5 -0
- data/spec/integration/collection_spec.rb +654 -154
- data/spec/integration/cursor_spec.rb +350 -0
- data/spec/integration/database_spec.rb +149 -3
- data/spec/integration/request_response_spec.rb +63 -0
- metadata +12 -2
@@ -0,0 +1,63 @@
|
|
1
|
+
require File.expand_path('spec_helper', File.dirname(__FILE__) + '/../')
|
2
|
+
|
3
|
+
describe EM::Mongo::RequestResponse do
|
4
|
+
before :each do
|
5
|
+
@response = EM::Mongo::RequestResponse.new
|
6
|
+
end
|
7
|
+
context "when first initialized" do
|
8
|
+
it "should not be complete" do
|
9
|
+
@response.completed?.should be_false
|
10
|
+
end
|
11
|
+
it "should not have succeeded" do
|
12
|
+
@response.succeeded?.should be_false
|
13
|
+
end
|
14
|
+
it "should not have failed" do
|
15
|
+
@response.failed?.should be_false
|
16
|
+
end
|
17
|
+
it "should not have any data" do
|
18
|
+
@response.data.should be_nil
|
19
|
+
end
|
20
|
+
it "should not have any error" do
|
21
|
+
@response.error.should be_nil
|
22
|
+
end
|
23
|
+
end
|
24
|
+
context "when succeeded" do
|
25
|
+
before(:each) { @response.succeed [:some,:data] }
|
26
|
+
|
27
|
+
it "should have completed" do
|
28
|
+
@response.completed?.should be_true
|
29
|
+
end
|
30
|
+
it "should have succeeded" do
|
31
|
+
@response.succeeded?.should be_true
|
32
|
+
end
|
33
|
+
it "should not have failed" do
|
34
|
+
@response.failed?.should be_false
|
35
|
+
end
|
36
|
+
it "should have data" do
|
37
|
+
@response.data.should == [:some, :data]
|
38
|
+
end
|
39
|
+
it "should not have an error" do
|
40
|
+
@response.error.should be_nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
context "when failed" do
|
44
|
+
before(:each) { @response.fail [RuntimeError, "crap!"]}
|
45
|
+
|
46
|
+
it "should have completed" do
|
47
|
+
@response.completed?.should be_true
|
48
|
+
end
|
49
|
+
it "should not have succeeded" do
|
50
|
+
@response.succeeded?.should be_false
|
51
|
+
end
|
52
|
+
it "should have failed" do
|
53
|
+
@response.failed?.should be_true
|
54
|
+
end
|
55
|
+
it "should not have data" do
|
56
|
+
@response.data.should be_nil
|
57
|
+
end
|
58
|
+
it "should have an error" do
|
59
|
+
@response.error.should == [RuntimeError, "crap!"]
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
metadata
CHANGED
@@ -2,10 +2,11 @@
|
|
2
2
|
name: em-mongo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.4.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- bcg
|
9
|
+
- PlasticLizard
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
@@ -58,13 +59,20 @@ files:
|
|
58
59
|
- lib/em-mongo/collection.rb
|
59
60
|
- lib/em-mongo/connection.rb
|
60
61
|
- lib/em-mongo/conversions.rb
|
62
|
+
- lib/em-mongo/core_ext.rb
|
63
|
+
- lib/em-mongo/cursor.rb
|
61
64
|
- lib/em-mongo/database.rb
|
62
65
|
- lib/em-mongo/exceptions.rb
|
66
|
+
- lib/em-mongo/prev.rb
|
67
|
+
- lib/em-mongo/request_response.rb
|
68
|
+
- lib/em-mongo/server_response.rb
|
63
69
|
- lib/em-mongo/support.rb
|
64
70
|
- lib/em-mongo.rb
|
65
71
|
- spec/integration/collection_spec.rb
|
66
72
|
- spec/integration/connection_spec.rb
|
73
|
+
- spec/integration/cursor_spec.rb
|
67
74
|
- spec/integration/database_spec.rb
|
75
|
+
- spec/integration/request_response_spec.rb
|
68
76
|
homepage: http://github.com/bcg/em-mongo
|
69
77
|
licenses: []
|
70
78
|
|
@@ -88,11 +96,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
96
|
requirements: []
|
89
97
|
|
90
98
|
rubyforge_project: em-mongo
|
91
|
-
rubygems_version: 1.8.
|
99
|
+
rubygems_version: 1.8.0
|
92
100
|
signing_key:
|
93
101
|
specification_version: 3
|
94
102
|
summary: An EventMachine driver for MongoDB.
|
95
103
|
test_files:
|
96
104
|
- spec/integration/collection_spec.rb
|
97
105
|
- spec/integration/connection_spec.rb
|
106
|
+
- spec/integration/cursor_spec.rb
|
98
107
|
- spec/integration/database_spec.rb
|
108
|
+
- spec/integration/request_response_spec.rb
|