ashikawa-core 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/.gitignore +11 -9
  2. data/.rspec +4 -0
  3. data/.travis.yml +8 -3
  4. data/CONTRIBUTING.md +5 -5
  5. data/Gemfile +5 -1
  6. data/Gemfile.devtools +65 -0
  7. data/Guardfile +1 -11
  8. data/README.md +14 -8
  9. data/Rakefile +5 -103
  10. data/ashikawa-core.gemspec +3 -29
  11. data/config/flay.yml +3 -0
  12. data/config/flog.yml +2 -0
  13. data/config/mutant.yml +3 -0
  14. data/config/roodi.yml +18 -0
  15. data/config/site.reek +95 -0
  16. data/config/yardstick.yml +2 -0
  17. data/lib/ashikawa-core/collection.rb +138 -178
  18. data/lib/ashikawa-core/connection.rb +74 -26
  19. data/lib/ashikawa-core/cursor.rb +30 -9
  20. data/lib/ashikawa-core/database.rb +23 -19
  21. data/lib/ashikawa-core/document.rb +33 -8
  22. data/lib/ashikawa-core/exceptions/collection_not_found.rb +15 -0
  23. data/lib/ashikawa-core/exceptions/document_not_found.rb +4 -0
  24. data/lib/ashikawa-core/exceptions/index_not_found.rb +15 -0
  25. data/lib/ashikawa-core/exceptions/no_collection_provided.rb +4 -0
  26. data/lib/ashikawa-core/exceptions/unknown_path.rb +15 -0
  27. data/lib/ashikawa-core/figure.rb +73 -0
  28. data/lib/ashikawa-core/index.rb +25 -7
  29. data/lib/ashikawa-core/query.rb +68 -55
  30. data/lib/ashikawa-core/status.rb +77 -0
  31. data/lib/ashikawa-core/version.rb +1 -1
  32. data/spec/acceptance/basic_spec.rb +14 -18
  33. data/spec/acceptance/index_spec.rb +4 -2
  34. data/spec/acceptance/query_spec.rb +18 -19
  35. data/spec/acceptance_auth/auth_spec.rb +2 -2
  36. data/spec/setup/arangodb.sh +34 -39
  37. data/spec/spec_helper.rb +27 -0
  38. data/spec/unit/collection_spec.rb +25 -73
  39. data/spec/unit/connection_spec.rb +46 -15
  40. data/spec/unit/cursor_spec.rb +3 -3
  41. data/spec/unit/database_spec.rb +8 -7
  42. data/spec/unit/document_spec.rb +2 -2
  43. data/spec/unit/exception_spec.rb +21 -0
  44. data/spec/unit/figure_spec.rb +28 -0
  45. data/spec/unit/index_spec.rb +1 -1
  46. data/spec/unit/query_spec.rb +25 -25
  47. data/spec/unit/spec_helper.rb +6 -4
  48. data/spec/unit/status_spec.rb +51 -0
  49. data/tasks/adjustments.rake +46 -0
  50. metadata +31 -203
@@ -24,7 +24,7 @@ describe Ashikawa::Core::Connection do
24
24
  subject { Ashikawa::Core::Connection.new "http://localhost:8529" }
25
25
 
26
26
  it "should send a get request" do
27
- stub_request(:get, "http://localhost:8529/_api/my/path").to_return body: '{ "name": "dude" }'
27
+ stub_request(:get, "http://localhost:8529/_api/my/path").to_return :body => '{ "name": "dude" }'
28
28
 
29
29
  subject.send_request "/my/path"
30
30
 
@@ -32,31 +32,31 @@ describe Ashikawa::Core::Connection do
32
32
  end
33
33
 
34
34
  it "should send a post request" do
35
- stub_request(:post, "http://localhost:8529/_api/my/path").with(:body => '{"name":"new_collection"}').to_return body: '{ "name": "dude" }'
35
+ stub_request(:post, "http://localhost:8529/_api/my/path").with(:body => '{"name":"new_collection"}').to_return :body => '{ "name": "dude" }'
36
36
 
37
- subject.send_request "/my/path", post: { :name => 'new_collection' }
37
+ subject.send_request "/my/path", :post => { :name => 'new_collection' }
38
38
 
39
39
  WebMock.should have_requested(:post, "http://localhost:8529/_api/my/path").with :body => '{"name":"new_collection"}'
40
40
  end
41
41
 
42
42
  it "should send a put request" do
43
- stub_request(:put, "http://localhost:8529/_api/my/path").with(:body => '{"name":"new_collection"}').to_return body: '{ "name": "dude" }'
43
+ stub_request(:put, "http://localhost:8529/_api/my/path").with(:body => '{"name":"new_collection"}').to_return :body => '{ "name": "dude" }'
44
44
 
45
- subject.send_request "/my/path", put: { :name => 'new_collection' }
45
+ subject.send_request "/my/path", :put => { :name => 'new_collection' }
46
46
 
47
47
  WebMock.should have_requested(:put, "http://localhost:8529/_api/my/path").with :body => '{"name":"new_collection"}'
48
48
  end
49
49
 
50
50
  it "should send a delete request" do
51
- stub_request(:delete, "http://localhost:8529/_api/my/path").to_return body: '{ "name": "dude" }'
51
+ stub_request(:delete, "http://localhost:8529/_api/my/path").to_return :body => '{ "name": "dude" }'
52
52
 
53
- subject.send_request "/my/path", delete: { }
53
+ subject.send_request "/my/path", :delete => { }
54
54
 
55
55
  WebMock.should have_requested(:delete, "http://localhost:8529/_api/my/path")
56
56
  end
57
57
 
58
58
  it "should parse JSON" do
59
- stub_request(:get, "http://localhost:8529/_api/my/path").to_return body: '{ "name": "dude" }'
59
+ stub_request(:get, "http://localhost:8529/_api/my/path").to_return :body => '{ "name": "dude" }'
60
60
 
61
61
  subject.send_request("/my/path").should == {"name" => "dude"}
62
62
  end
@@ -66,7 +66,7 @@ describe Ashikawa::Core::Connection do
66
66
  subject { Ashikawa::Core::Connection.new }
67
67
 
68
68
  it "should authenticate with username and password" do
69
- subject.authenticate_with username: "testuser", password: "testpassword"
69
+ subject.authenticate_with :username => "testuser", :password => "testpassword"
70
70
 
71
71
  subject.username.should == "testuser"
72
72
  subject.password.should == "testpassword"
@@ -77,32 +77,63 @@ describe Ashikawa::Core::Connection do
77
77
  end
78
78
 
79
79
  it "should tell if authentication is enabled" do
80
- subject.authenticate_with username: "testuser", password: "testpassword"
80
+ subject.authenticate_with :username => "testuser", :password => "testpassword"
81
81
  subject.authentication?.should be_true
82
82
  end
83
83
 
84
84
  it "should only accept a username & password pairs" do
85
85
  expect {
86
- subject.authenticate_with username: "kitty"
86
+ subject.authenticate_with :username => "kitty"
87
87
  }.to raise_error(ArgumentError)
88
88
 
89
89
  expect {
90
- subject.authenticate_with password: "cheezburger?"
90
+ subject.authenticate_with :password => "cheezburger?"
91
91
  }.to raise_error(ArgumentError)
92
92
  end
93
93
 
94
94
  it "should allow chaining" do
95
- subject.authenticate_with(username: "a", password: "b").should == subject
95
+ subject.authenticate_with(:username => "a", :password => "b").should == subject
96
96
  end
97
97
 
98
98
  it "should send the authentication data with every GET request" do
99
- stub_request(:get, "http://user:pass@localhost:8529/_api/my/path").to_return body: '{ "name": "dude" }'
99
+ stub_request(:get, "http://user:pass@localhost:8529/_api/my/path").to_return :body => '{ "name": "dude" }'
100
100
 
101
- subject.authenticate_with username: "user", password: "pass"
101
+ subject.authenticate_with :username => "user", :password => "pass"
102
102
  subject.send_request "/my/path"
103
103
 
104
104
  WebMock.should have_requested(:get, "http://user:pass@localhost:8529/_api/my/path")
105
105
  end
106
106
  end
107
107
 
108
+ describe "exception handling" do
109
+ subject { Ashikawa::Core::Connection.new }
110
+
111
+ it "should raise an exception if a document is not found" do
112
+ stub_request(:get, "http://localhost:8529/_api/document/4590/333").to_return do
113
+ raise RestClient::ResourceNotFound
114
+ end
115
+ expect { subject.send_request "/document/4590/333" }.to raise_error(Ashikawa::Core::DocumentNotFoundException)
116
+ end
117
+
118
+ it "should raise an exception if a collection is not found" do
119
+ stub_request(:get, "http://localhost:8529/_api/collection/4590").to_return do
120
+ raise RestClient::ResourceNotFound
121
+ end
122
+ expect { subject.send_request "/collection/4590" }.to raise_error(Ashikawa::Core::CollectionNotFoundException)
123
+ end
124
+
125
+ it "should raise an exception if an index is not found" do
126
+ stub_request(:get, "http://localhost:8529/_api/index/4590/333").to_return do
127
+ raise RestClient::ResourceNotFound
128
+ end
129
+ expect { subject.send_request "/index/4590/333" }.to raise_error(Ashikawa::Core::IndexNotFoundException)
130
+ end
131
+
132
+ it "should raise an exception for unknown pathes" do
133
+ stub_request(:get, "http://localhost:8529/_api/unknown_path/4590/333").to_return do
134
+ raise RestClient::ResourceNotFound
135
+ end
136
+ expect { subject.send_request "/unknown_path/4590/333" }.to raise_error(Ashikawa::Core::UnknownPath)
137
+ end
138
+ end
108
139
  end
@@ -29,7 +29,7 @@ describe Ashikawa::Core::Cursor do
29
29
  it "should iterate over all documents of a cursor" do
30
30
  first = true
31
31
 
32
- @database.stub(:send_request).with("/cursor/26011191", put: {}) do
32
+ @database.stub(:send_request).with("/cursor/26011191", :put => {}) do
33
33
  if first
34
34
  first = false
35
35
  server_response("/cursor/26011191-2")
@@ -48,7 +48,7 @@ describe Ashikawa::Core::Cursor do
48
48
  it "should be deletable" do
49
49
  @database.stub(:send_request)
50
50
  @database.should_receive(:send_request).with("/cursor/26011191",
51
- delete: {})
51
+ :delete => {})
52
52
 
53
53
  subject.delete
54
54
  end
@@ -56,7 +56,7 @@ describe Ashikawa::Core::Cursor do
56
56
  it "should be enumerable" do
57
57
  first = true
58
58
 
59
- @database.stub(:send_request).with("/cursor/26011191", put: {}) do
59
+ @database.stub(:send_request).with("/cursor/26011191", :put => {}) do
60
60
  if first
61
61
  first = false
62
62
  server_response("/cursor/26011191-2")
@@ -41,9 +41,9 @@ describe Ashikawa::Core::Database do
41
41
  subject { Ashikawa::Core::Database.new @connection }
42
42
 
43
43
  it "should delegate authentication to the connection" do
44
- @connection.should_receive(:authenticate_with).with({ username: "user", password: "password" })
44
+ @connection.should_receive(:authenticate_with).with({ :username => "user", :password => "password" })
45
45
 
46
- subject.authenticate_with username: "user", password: "password"
46
+ subject.authenticate_with :username => "user", :password => "password"
47
47
  end
48
48
 
49
49
  it "should fetch all available collections" do
@@ -66,15 +66,16 @@ describe Ashikawa::Core::Database do
66
66
  end
67
67
 
68
68
  it "should create a single collection if it doesn't exist" do
69
- @connection.stub :send_request do |path, method = {}|
69
+ @connection.stub :send_request do |path, method|
70
+ method ||= {}
70
71
  if method.has_key? :post
71
72
  server_response("collections/4590")
72
73
  else
73
- raise RestClient::ResourceNotFound
74
+ raise Ashikawa::Core::CollectionNotFoundException
74
75
  end
75
76
  end
76
77
  @connection.should_receive(:send_request).with("/collection/new_collection")
77
- @connection.should_receive(:send_request).with("/collection", post: { name: "new_collection"} )
78
+ @connection.should_receive(:send_request).with("/collection", :post => { :name => "new_collection"} )
78
79
 
79
80
  Ashikawa::Core::Collection.should_receive(:new).with(subject, server_response("collections/4590"))
80
81
 
@@ -82,9 +83,9 @@ describe Ashikawa::Core::Database do
82
83
  end
83
84
 
84
85
  it "should send a request via the connection object" do
85
- @connection.should_receive(:send_request).with("/my/path", post: { data: "mydata" })
86
+ @connection.should_receive(:send_request).with("/my/path", :post => { :data => "mydata" })
86
87
 
87
- subject.send_request "/my/path", post: { data: "mydata" }
88
+ subject.send_request "/my/path", :post => { :data => "mydata" }
88
89
  end
89
90
  end
90
91
  end
@@ -44,7 +44,7 @@ describe Ashikawa::Core::Document do
44
44
 
45
45
  it "should be deletable" do
46
46
  database.should_receive(:send_request).with("document/#{raw_data['_id']}",
47
- { delete: {} }
47
+ { :delete => {} }
48
48
  )
49
49
 
50
50
  subject.delete
@@ -52,7 +52,7 @@ describe Ashikawa::Core::Document do
52
52
 
53
53
  it "should store changes to the database" do
54
54
  database.should_receive(:send_request).with("document/#{raw_data['_id']}",
55
- { put: { "first_name" => "The", "last_name" => "Other" } }
55
+ { :put => { "first_name" => "The", "last_name" => "Other" } }
56
56
  )
57
57
 
58
58
  subject["last_name"] = "Other"
@@ -1,5 +1,8 @@
1
1
  require "ashikawa-core/exceptions/document_not_found"
2
+ require "ashikawa-core/exceptions/collection_not_found"
3
+ require "ashikawa-core/exceptions/index_not_found"
2
4
  require "ashikawa-core/exceptions/no_collection_provided"
5
+ require "ashikawa-core/exceptions/unknown_path"
3
6
 
4
7
  describe Ashikawa::Core::DocumentNotFoundException do
5
8
  it "should have a good explanation" do
@@ -7,8 +10,26 @@ describe Ashikawa::Core::DocumentNotFoundException do
7
10
  end
8
11
  end
9
12
 
13
+ describe Ashikawa::Core::CollectionNotFoundException do
14
+ it "should have a good explanation" do
15
+ subject.to_s.should include "does not exist"
16
+ end
17
+ end
18
+
19
+ describe Ashikawa::Core::IndexNotFoundException do
20
+ it "should have a good explanation" do
21
+ subject.to_s.should include "does not exist"
22
+ end
23
+ end
24
+
10
25
  describe Ashikawa::Core::NoCollectionProvidedException do
11
26
  it "should have a good explanation" do
12
27
  subject.to_s.should include "without a collection"
13
28
  end
14
29
  end
30
+
31
+ describe Ashikawa::Core::UnknownPath do
32
+ it "should have a good explanation" do
33
+ subject.to_s.should include "path is unknown"
34
+ end
35
+ end
@@ -0,0 +1,28 @@
1
+ require "ashikawa-core/figure"
2
+
3
+ describe Ashikawa::Core::Figure do
4
+ let(:raw_figures) {
5
+ {
6
+ "datafiles" => {
7
+ "count" => 1
8
+ },
9
+ "alive" => {
10
+ "size" => 0,
11
+ "count" => 0
12
+ },
13
+ "dead" => {
14
+ "size" => 2384,
15
+ "count" => 149
16
+ }
17
+ }
18
+ }
19
+ subject { Ashikawa::Core::Figure.new raw_figures }
20
+
21
+ it "should check for the figures" do
22
+ subject.datafiles_count.should == 1
23
+ subject.alive_size.should == 0
24
+ subject.alive_count.should == 0
25
+ subject.dead_size.should == 2384
26
+ subject.dead_count.should == 149
27
+ end
28
+ end
@@ -30,7 +30,7 @@ describe Ashikawa::Core::Index do
30
30
 
31
31
  it "should be deletable" do
32
32
  collection.should_receive(:send_request).with("index/167137465/168054969",
33
- delete: {})
33
+ :delete => {})
34
34
  collection.should_receive(:id).and_return(167137465)
35
35
 
36
36
  subject.delete
@@ -16,7 +16,7 @@ describe Ashikawa::Core::Query do
16
16
  describe "get all" do
17
17
  it "should list all documents" do
18
18
  collection.stub(:send_request).and_return { server_response('simple-queries/all') }
19
- collection.should_receive(:send_request).with("/simple/all", put: {"collection" => "example_1"})
19
+ collection.should_receive(:send_request).with("/simple/all", :put => {"collection" => "example_1"})
20
20
 
21
21
  Ashikawa::Core::Cursor.should_receive(:new)
22
22
 
@@ -25,20 +25,20 @@ describe Ashikawa::Core::Query do
25
25
 
26
26
  it "should be able to limit the number of documents" do
27
27
  collection.stub(:send_request).and_return { server_response('simple-queries/all_skip') }
28
- collection.should_receive(:send_request).with("/simple/all", put: {"collection" => "example_1", "limit" => 1})
28
+ collection.should_receive(:send_request).with("/simple/all", :put => {"collection" => "example_1", "limit" => 1})
29
29
 
30
30
  Ashikawa::Core::Cursor.should_receive(:new)
31
31
 
32
- subject.all limit: 1
32
+ subject.all :limit => 1
33
33
  end
34
34
 
35
35
  it "should be able to skip documents" do
36
36
  collection.stub(:send_request).and_return { server_response('simple-queries/all_limit') }
37
- collection.should_receive(:send_request).with("/simple/all", put: {"collection" => "example_1", "skip" => 1})
37
+ collection.should_receive(:send_request).with("/simple/all", :put => {"collection" => "example_1", "skip" => 1})
38
38
 
39
39
  Ashikawa::Core::Cursor.should_receive(:new)
40
40
 
41
- subject.all skip: 1
41
+ subject.all :skip => 1
42
42
  end
43
43
  end
44
44
 
@@ -49,7 +49,7 @@ describe Ashikawa::Core::Query do
49
49
  collection.stub(:database).and_return { double }
50
50
 
51
51
  collection.stub(:send_request).and_return { server_response('simple-queries/example') }
52
- collection.should_receive(:send_request).with("/simple/first-example", put:
52
+ collection.should_receive(:send_request).with("/simple/first-example", :put =>
53
53
  {"collection" => "example_1", "example" => { :hello => "world"}})
54
54
 
55
55
  Ashikawa::Core::Document.should_receive(:new)
@@ -63,7 +63,7 @@ describe Ashikawa::Core::Query do
63
63
 
64
64
  it "should find all fitting documents" do
65
65
  collection.stub(:send_request).and_return { server_response('simple-queries/example') }
66
- collection.should_receive(:send_request).with("/simple/by-example", put:
66
+ collection.should_receive(:send_request).with("/simple/by-example", :put =>
67
67
  {"collection" => "example_1", "example" => { :hello => "world"}})
68
68
 
69
69
  Ashikawa::Core::Cursor.should_receive(:new)
@@ -73,43 +73,43 @@ describe Ashikawa::Core::Query do
73
73
 
74
74
  it "should be able to limit the number of documents" do
75
75
  collection.stub(:send_request).and_return { server_response('simple-queries/example') }
76
- collection.should_receive(:send_request).with("/simple/by-example", put: {"collection" => "example_1", "limit" => 2, "example" => { :hello => "world"}})
76
+ collection.should_receive(:send_request).with("/simple/by-example", :put => {"collection" => "example_1", "limit" => 2, "example" => { :hello => "world"}})
77
77
 
78
78
  Ashikawa::Core::Cursor.should_receive(:new)
79
79
 
80
- subject.by_example example, limit: 2
80
+ subject.by_example example, :limit => 2
81
81
  end
82
82
 
83
83
  it "should be able to skip documents" do
84
84
  collection.stub(:send_request).and_return { server_response('simple-queries/example') }
85
- collection.should_receive(:send_request).with("/simple/by-example", put:
85
+ collection.should_receive(:send_request).with("/simple/by-example", :put =>
86
86
  {"collection" => "example_1", "skip" => 1, "example" => { :hello => "world"}})
87
87
 
88
88
  Ashikawa::Core::Cursor.should_receive(:new)
89
89
 
90
- subject.by_example example, skip: 1
90
+ subject.by_example example, :skip => 1
91
91
  end
92
92
  end
93
93
 
94
94
  describe "near a geolocation" do
95
95
  it "should find documents based on latitude/longitude" do
96
96
  collection.stub(:send_request).and_return { server_response('simple-queries/near') }
97
- collection.should_receive(:send_request).with("/simple/near", put: { "collection" => "example_1", "latitude" => 0, "longitude" => 0 })
97
+ collection.should_receive(:send_request).with("/simple/near", :put => { "collection" => "example_1", "latitude" => 0, "longitude" => 0 })
98
98
 
99
99
  Ashikawa::Core::Cursor.should_receive(:new)
100
100
 
101
- subject.near latitude: 0, longitude: 0
101
+ subject.near :latitude => 0, :longitude => 0
102
102
  end
103
103
  end
104
104
 
105
105
  describe "within a radious of a geolocation" do
106
106
  it "should look for documents based on latidude/longitude" do
107
107
  collection.stub(:send_request).and_return { server_response('simple-queries/within') }
108
- collection.should_receive(:send_request).with("/simple/within" , put: { "collection" => "example_1", "latitude" => 0, "longitude" => 0, "radius" => 2 })
108
+ collection.should_receive(:send_request).with("/simple/within" , :put => { "collection" => "example_1", "latitude" => 0, "longitude" => 0, "radius" => 2 })
109
109
 
110
110
  Ashikawa::Core::Cursor.should_receive(:new)
111
111
 
112
- subject.within latitude: 0, longitude: 0, radius: 2
112
+ subject.within :latitude => 0, :longitude => 0, :radius => 2
113
113
  end
114
114
  end
115
115
 
@@ -117,11 +117,11 @@ describe Ashikawa::Core::Query do
117
117
  it "should look for documents with an attribute in that range" do
118
118
  arguments = { "collection" => "example_1", "attribute" => "age", "left" => 50, "right" => 60, "closed" => false}
119
119
  collection.stub(:send_request).and_return { server_response('simple-queries/range') }
120
- collection.should_receive(:send_request).with("/simple/range" , put: arguments)
120
+ collection.should_receive(:send_request).with("/simple/range" , :put => arguments)
121
121
 
122
122
  Ashikawa::Core::Cursor.should_receive(:new)
123
123
 
124
- subject.in_range attribute: "age", left: 50, right: 60, closed: false
124
+ subject.in_range :attribute => "age", :left => 50, :right => 60, :closed => false
125
125
  end
126
126
  end
127
127
 
@@ -129,21 +129,21 @@ describe Ashikawa::Core::Query do
129
129
  it "should be able to execute it" do
130
130
  collection.stub(:database).and_return double
131
131
  collection.stub(:send_request).and_return { server_response("cursor/query") }
132
- collection.should_receive(:send_request).with("/cursor", post: {
132
+ collection.should_receive(:send_request).with("/cursor", :post => {
133
133
  "query" => "FOR u IN users LIMIT 2 RETURN u",
134
134
  "count" => true,
135
135
  "batchSize" => 2
136
136
  })
137
137
  Ashikawa::Core::Cursor.should_receive(:new).with(collection.database, server_response("cursor/query"))
138
138
 
139
- subject.execute "FOR u IN users LIMIT 2 RETURN u", count: true, batch_size: 2
139
+ subject.execute "FOR u IN users LIMIT 2 RETURN u", :count => true, :batch_size => 2
140
140
  end
141
141
 
142
142
  it "should return true when asked if a valid query is valid" do
143
143
  query = "FOR u IN users LIMIT 2 RETURN u"
144
144
 
145
145
  collection.stub(:send_request).and_return { server_response("query/valid") }
146
- collection.should_receive(:send_request).with("/query", post: {
146
+ collection.should_receive(:send_request).with("/query", :post => {
147
147
  "query" => query
148
148
  })
149
149
 
@@ -156,7 +156,7 @@ describe Ashikawa::Core::Query do
156
156
  collection.stub(:send_request) do
157
157
  raise RestClient::BadRequest
158
158
  end
159
- collection.should_receive(:send_request).with("/query", post: {
159
+ collection.should_receive(:send_request).with("/query", :post => {
160
160
  "query" => query
161
161
  })
162
162
 
@@ -177,21 +177,21 @@ describe Ashikawa::Core::Query do
177
177
  describe "with an AQL query" do
178
178
  it "should be able to execute it" do
179
179
  database.stub(:send_request).and_return { server_response("cursor/query") }
180
- database.should_receive(:send_request).with("/cursor", post: {
180
+ database.should_receive(:send_request).with("/cursor", :post => {
181
181
  "query" => "FOR u IN users LIMIT 2 RETURN u",
182
182
  "count" => true,
183
183
  "batchSize" => 2
184
184
  })
185
185
  Ashikawa::Core::Cursor.should_receive(:new).with(database, server_response("cursor/query"))
186
186
 
187
- subject.execute "FOR u IN users LIMIT 2 RETURN u", count: true, batch_size: 2
187
+ subject.execute "FOR u IN users LIMIT 2 RETURN u", :count => true, :batch_size => 2
188
188
  end
189
189
 
190
190
  it "should return true when asked if a valid query is valid" do
191
191
  query = "FOR u IN users LIMIT 2 RETURN u"
192
192
 
193
193
  database.stub(:send_request).and_return { server_response("query/valid") }
194
- database.should_receive(:send_request).with("/query", post: {
194
+ database.should_receive(:send_request).with("/query", :post => {
195
195
  "query" => query
196
196
  })
197
197
 
@@ -204,7 +204,7 @@ describe Ashikawa::Core::Query do
204
204
  database.stub(:send_request) do
205
205
  raise RestClient::BadRequest
206
206
  end
207
- database.should_receive(:send_request).with("/query", post: {
207
+ database.should_receive(:send_request).with("/query", :post => {
208
208
  "query" => query
209
209
  })
210
210