ashikawa-core 0.8.0 → 0.9.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.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +3 -3
  4. data/CHANGELOG.md +49 -0
  5. data/Gemfile +3 -2
  6. data/Gemfile.devtools +14 -22
  7. data/Guardfile +3 -2
  8. data/README.md +37 -6
  9. data/Rakefile +2 -1
  10. data/ashikawa-core.gemspec +2 -2
  11. data/cache/Mac_applications +1 -0
  12. data/config/devtools.yml +5 -0
  13. data/config/flay.yml +1 -1
  14. data/config/flog.yml +1 -2
  15. data/config/reek.yml +1 -1
  16. data/config/rubocop.yml +23 -25
  17. data/lib/ashikawa-core.rb +6 -5
  18. data/lib/ashikawa-core/collection.rb +142 -165
  19. data/lib/ashikawa-core/configuration.rb +41 -2
  20. data/lib/ashikawa-core/connection.rb +17 -16
  21. data/lib/ashikawa-core/cursor.rb +18 -12
  22. data/lib/ashikawa-core/database.rb +69 -59
  23. data/lib/ashikawa-core/document.rb +22 -20
  24. data/lib/ashikawa-core/edge.rb +8 -6
  25. data/lib/ashikawa-core/exceptions/client_error.rb +1 -0
  26. data/lib/ashikawa-core/exceptions/client_error/authentication_failed.rb +25 -0
  27. data/lib/ashikawa-core/exceptions/client_error/bad_syntax.rb +3 -2
  28. data/lib/ashikawa-core/exceptions/client_error/resource_not_found.rb +3 -2
  29. data/lib/ashikawa-core/exceptions/client_error/resource_not_found/collection_not_found.rb +3 -2
  30. data/lib/ashikawa-core/exceptions/client_error/resource_not_found/document_not_found.rb +3 -2
  31. data/lib/ashikawa-core/exceptions/client_error/resource_not_found/index_not_found.rb +3 -2
  32. data/lib/ashikawa-core/exceptions/no_collection_provided.rb +1 -0
  33. data/lib/ashikawa-core/exceptions/server_error.rb +1 -0
  34. data/lib/ashikawa-core/exceptions/server_error/json_error.rb +3 -2
  35. data/lib/ashikawa-core/figure.rb +18 -17
  36. data/lib/ashikawa-core/index.rb +15 -5
  37. data/lib/ashikawa-core/key_options.rb +5 -4
  38. data/lib/ashikawa-core/query.rb +38 -27
  39. data/lib/ashikawa-core/request_preprocessor.rb +4 -3
  40. data/lib/ashikawa-core/response_preprocessor.rb +64 -24
  41. data/lib/ashikawa-core/status.rb +1 -0
  42. data/lib/ashikawa-core/transaction.rb +12 -11
  43. data/lib/ashikawa-core/version.rb +2 -1
  44. data/spec/acceptance/basic_spec.rb +117 -116
  45. data/spec/acceptance/index_spec.rb +18 -15
  46. data/spec/acceptance/query_spec.rb +61 -64
  47. data/spec/acceptance/spec_helper.rb +26 -3
  48. data/spec/acceptance/transactions_spec.rb +12 -16
  49. data/spec/setup/arangodb.sh +2 -2
  50. data/spec/unit/collection_spec.rb +224 -242
  51. data/spec/unit/configuration_spec.rb +64 -0
  52. data/spec/unit/connection_spec.rb +121 -111
  53. data/spec/unit/cursor_spec.rb +78 -65
  54. data/spec/unit/database_spec.rb +112 -163
  55. data/spec/unit/document_spec.rb +74 -70
  56. data/spec/unit/edge_spec.rb +45 -33
  57. data/spec/unit/exception_spec.rb +28 -38
  58. data/spec/unit/figure_spec.rb +44 -47
  59. data/spec/unit/index_spec.rb +27 -24
  60. data/spec/unit/key_options_spec.rb +19 -17
  61. data/spec/unit/query_spec.rb +186 -135
  62. data/spec/unit/spec_helper.rb +14 -3
  63. data/spec/unit/status_spec.rb +37 -37
  64. data/spec/unit/transaction_spec.rb +71 -74
  65. data/tasks/adjustments.rake +10 -34
  66. metadata +11 -13
  67. data/spec/acceptance/arango_helper.rb +0 -27
  68. data/spec/acceptance_auth/arango_helper.rb +0 -30
  69. data/spec/acceptance_auth/auth_spec.rb +0 -40
  70. data/spec/acceptance_auth/spec_helper.rb +0 -6
@@ -1,232 +1,181 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  require 'unit/spec_helper'
2
3
  require 'ashikawa-core/database'
3
4
 
4
5
  describe Ashikawa::Core::Database do
5
6
  subject { Ashikawa::Core::Database }
6
7
 
7
- before :each do
8
- double(Ashikawa::Core::Connection)
9
- double(Ashikawa::Core::Collection)
10
- double(Ashikawa::Core::Cursor)
11
- double(Ashikawa::Core::Transaction)
12
- @connection = double("connection", :host => "localhost", :port => 8529, :scheme => "http")
8
+ let(:url) { double }
9
+ let(:host) { double }
10
+ let(:port) { double }
11
+ let(:scheme) { double }
12
+ let(:connection) { double('connection', host: host, port: port, scheme: scheme) }
13
+ let(:js_function) { double }
14
+ let(:collections) { double }
15
+ let(:transaction) { double }
16
+ let(:logger) { double }
17
+ let(:adapter) { double }
18
+ let(:configuration) { double }
19
+
20
+ it 'should initialize with a configuration object' do
21
+ expect(Ashikawa::Core::Configuration).to receive(:new)
22
+ .and_return(configuration)
23
+ expect(configuration).to receive(:connection)
24
+ expect { |b| Ashikawa::Core::Database.new(&b) }.to yield_with_args(configuration)
13
25
  end
14
26
 
15
- it "should initialize with a connection" do
16
- @connection.stub(:host) { "localhost" }
17
- @connection.stub(:port) { 8529 }
18
-
19
- database = subject.new do |config|
20
- config.connection = @connection
21
- end
22
- database.host.should == "localhost"
23
- database.port.should == 8529
24
- end
25
-
26
- it "should initialize with a connection string" do
27
- Ashikawa::Core::Connection.stub(:new).with("http://localhost:8529", {
28
- :logger => nil,
29
- :adapter => nil
30
- }).and_return(double)
31
- Ashikawa::Core::Connection.should_receive(:new).with("http://localhost:8529", {
32
- :logger => nil,
33
- :adapter => nil
34
- })
35
-
36
- subject.new do |config|
37
- config.url = "http://localhost:8529"
38
- end
39
- end
40
-
41
- it "should initialize with a connection string and logger" do
42
- logger = double
43
- Ashikawa::Core::Connection.stub(:new).with("http://localhost:8529", {
44
- :logger => logger,
45
- :adapter => nil
46
- }).and_return(double)
47
- Ashikawa::Core::Connection.should_receive(:new).with("http://localhost:8529", {
48
- :logger => logger,
49
- :adapter => nil
50
- })
51
-
52
- subject.new do |config|
53
- config.url = "http://localhost:8529"
54
- config.logger = logger
55
- end
56
- end
57
-
58
- it "should initialize with a connection string and adapter" do
59
- adapter = double
60
- Ashikawa::Core::Connection.stub(:new).with("http://localhost:8529", {
61
- :logger => nil,
62
- :adapter => adapter
63
- }).and_return(double)
64
- Ashikawa::Core::Connection.should_receive(:new).with("http://localhost:8529", {
65
- :logger => nil,
66
- :adapter => adapter
67
- })
68
-
69
- subject.new do |config|
70
- config.url = "http://localhost:8529"
71
- config.adapter = adapter
72
- end
73
- end
74
-
75
- it "should throw an argument error when neither url nor connection was provided" do
76
- adapter = double
77
- logger = double
78
-
79
- expect {
80
- subject.new do |config|
81
- config.adapter = adapter
82
- config.logger = logger
27
+ describe 'initialized database' do
28
+ subject do
29
+ Ashikawa::Core::Database.new do |config|
30
+ config.connection = connection
83
31
  end
84
- }.to raise_error(ArgumentError, /either an url or a connection/)
85
- end
86
-
87
- it "should create a query" do
88
- database = subject.new do |config|
89
- config.connection = @connection
90
32
  end
91
33
 
92
- double Ashikawa::Core::Query
93
- Ashikawa::Core::Query.stub(:new)
94
- Ashikawa::Core::Query.should_receive(:new).exactly(1).times.with(database)
95
-
96
- database.query
97
- end
34
+ it 'should create a query' do
35
+ expect(Ashikawa::Core::Query).to receive(:new)
36
+ .exactly(1).times
37
+ .with(subject)
98
38
 
99
- describe "initialized database" do
100
- subject {
101
- Ashikawa::Core::Database.new do |config|
102
- config.connection = @connection
103
- end
104
- }
39
+ subject.query
40
+ end
105
41
 
106
- it "should delegate authentication to the connection" do
107
- @connection.should_receive(:authenticate_with).with({ :username => "user", :password => "password" })
42
+ it 'should delegate authentication to the connection' do
43
+ expect(connection).to receive(:authenticate_with)
44
+ .with({ username: 'user', password: 'password' })
108
45
 
109
- subject.authenticate_with :username => "user", :password => "password"
46
+ subject.authenticate_with username: 'user', password: 'password'
110
47
  end
111
48
 
112
- it "should fetch all available non-system collections" do
113
- @connection.stub(:send_request) {|path| server_response("collections/all") }
114
- @connection.should_receive(:send_request).with("collection")
49
+ it 'should fetch all available non-system collections' do
50
+ expect(connection).to receive(:send_request)
51
+ .with('collection')
52
+ .and_return { server_response('collections/all') }
115
53
 
116
54
  (0..1).each do |k|
117
- Ashikawa::Core::Collection.should_receive(:new).with(subject, server_response("collections/all")["collections"][k])
55
+ expect(Ashikawa::Core::Collection).to receive(:new)
56
+ .with(subject, server_response('collections/all')['collections'][k])
118
57
  end
119
58
 
120
- subject.collections.length.should == 2
59
+ expect(subject.collections.length).to eq(2)
121
60
  end
122
61
 
123
- it "should fetch all available non-system collections" do
124
- @connection.stub(:send_request) {|path| server_response("collections/all") }
125
- @connection.should_receive(:send_request).with("collection")
62
+ it 'should fetch all available non-system collections' do
63
+ expect(connection).to receive(:send_request)
64
+ .with('collection')
65
+ .and_return { server_response('collections/all') }
126
66
 
127
- Ashikawa::Core::Collection.should_receive(:new).exactly(5).times
67
+ expect(Ashikawa::Core::Collection).to receive(:new)
68
+ .exactly(5).times
128
69
 
129
- subject.system_collections.length.should == 5
70
+ expect(subject.system_collections.length).to eq(5)
130
71
  end
131
72
 
132
- it "should create a non volatile collection by default" do
133
- @connection.stub(:send_request) { |path| server_response("collections/60768679") }
134
- @connection.should_receive(:send_request).with("collection",
135
- :post => { :name => "volatile_collection"})
73
+ it 'should create a non volatile collection by default' do
74
+ expect(connection).to receive(:send_request)
75
+ .with('collection', post: { name: 'volatile_collection' })
76
+ .and_return { server_response('collections/60768679') }
136
77
 
137
- Ashikawa::Core::Collection.should_receive(:new).with(subject, server_response("collections/60768679"))
78
+ expect(Ashikawa::Core::Collection).to receive(:new)
79
+ .with(subject, server_response('collections/60768679'))
138
80
 
139
- subject.create_collection("volatile_collection")
81
+ subject.create_collection('volatile_collection')
140
82
  end
141
83
 
142
- it "should create a volatile collection when asked" do
143
- @connection.stub(:send_request) { |path| server_response("collections/60768679") }
144
- @connection.should_receive(:send_request).with("collection",
145
- :post => { :name => "volatile_collection", :isVolatile => true})
84
+ it 'should create a volatile collection when asked' do
85
+ expect(connection).to receive(:send_request)
86
+ .with('collection', post: { name: 'volatile_collection', isVolatile: true })
87
+ .and_return { |path| server_response('collections/60768679') }
146
88
 
147
- Ashikawa::Core::Collection.should_receive(:new).with(subject, server_response("collections/60768679"))
89
+ expect(Ashikawa::Core::Collection).to receive(:new)
90
+ .with(subject, server_response('collections/60768679'))
148
91
 
149
- subject.create_collection("volatile_collection", :is_volatile => true)
92
+ subject.create_collection('volatile_collection', is_volatile: true)
150
93
  end
151
94
 
152
- it "should create an autoincrement collection when asked" do
153
- @connection.should_receive(:send_request).with("collection",
154
- :post => { :name => "autoincrement_collection", :keyOptions => {
155
- :type => "autoincrement",
156
- :offset => 0,
157
- :increment => 10,
158
- :allowUserKeys => false
95
+ it 'should create an autoincrement collection when asked' do
96
+ expect(connection).to receive(:send_request).with('collection',
97
+ post: {
98
+ name: 'autoincrement_collection', keyOptions: {
99
+ type: 'autoincrement',
100
+ offset: 0,
101
+ increment: 10,
102
+ allowUserKeys: false
103
+ }
159
104
  }
160
- })
105
+ )
161
106
 
162
- Ashikawa::Core::Collection.should_receive(:new)
107
+ expect(Ashikawa::Core::Collection).to receive(:new)
163
108
 
164
- subject.create_collection("autoincrement_collection", :key_options => {
165
- :type => :autoincrement,
166
- :offset => 0,
167
- :increment => 10,
168
- :allow_user_keys => false
109
+ subject.create_collection('autoincrement_collection', key_options: {
110
+ type: :autoincrement,
111
+ offset: 0,
112
+ increment: 10,
113
+ allow_user_keys: false
169
114
  })
170
115
  end
171
116
 
172
- it "should create an edge collection when asked" do
173
- @connection.stub(:send_request) { |path| server_response("collections/60768679") }
174
- @connection.should_receive(:send_request).with("collection",
175
- :post => { :name => "volatile_collection", :type => 3})
117
+ it 'should create an edge collection when asked' do
118
+ expect(connection).to receive(:send_request)
119
+ .with('collection', post: { name: 'volatile_collection', type: 3 })
120
+ .and_return { |path| server_response('collections/60768679') }
176
121
 
177
- Ashikawa::Core::Collection.should_receive(:new).with(subject, server_response("collections/60768679"))
122
+ expect(Ashikawa::Core::Collection).to receive(:new)
123
+ .with(subject, server_response('collections/60768679'))
178
124
 
179
- subject.create_collection("volatile_collection", :content_type => :edge)
125
+ subject.create_collection('volatile_collection', content_type: :edge)
180
126
  end
181
127
 
182
- it "should fetch a single collection if it exists" do
183
- @connection.stub(:send_request) { |path| server_response("collections/60768679") }
184
- @connection.should_receive(:send_request).with("collection/60768679")
128
+ it 'should fetch a single collection if it exists' do
129
+ expect(connection).to receive(:send_request)
130
+ .with('collection/60768679')
131
+ .and_return { |path| server_response('collections/60768679') }
185
132
 
186
- Ashikawa::Core::Collection.should_receive(:new).with(subject, server_response("collections/60768679"))
133
+ expect(Ashikawa::Core::Collection).to receive(:new)
134
+ .with(subject, server_response('collections/60768679'))
187
135
 
188
- subject.collection(60768679)
136
+ subject.collection(60_768_679)
189
137
  end
190
138
 
191
- it "should fetch a single collection with the array syntax" do
192
- @connection.stub(:send_request) { |path| server_response("collections/60768679") }
193
- @connection.should_receive(:send_request).with("collection/60768679")
139
+ it 'should fetch a single collection with the array syntax' do
140
+ expect(connection).to receive(:send_request)
141
+ .with('collection/60768679')
142
+ .and_return { |path| server_response('collections/60768679') }
194
143
 
195
- Ashikawa::Core::Collection.should_receive(:new).with(subject, server_response("collections/60768679"))
144
+ expect(Ashikawa::Core::Collection).to receive(:new)
145
+ .with(subject, server_response('collections/60768679'))
196
146
 
197
- subject[60768679]
147
+ subject[60_768_679]
198
148
  end
199
149
 
200
150
  it "should create a single collection if it doesn't exist" do
201
- @connection.stub :send_request do |path, method|
151
+ allow(connection).to receive :send_request do |path, method|
202
152
  method ||= {}
203
- if method.has_key? :post
204
- server_response("collections/60768679")
153
+ if method.key? :post
154
+ server_response('collections/60768679')
205
155
  else
206
156
  raise Ashikawa::Core::CollectionNotFoundException
207
157
  end
208
158
  end
209
- @connection.should_receive(:send_request).with("collection/new_collection")
210
- @connection.should_receive(:send_request).with("collection", :post => { :name => "new_collection"})
211
-
212
- Ashikawa::Core::Collection.should_receive(:new).with(subject, server_response("collections/60768679"))
159
+ expect(connection).to receive(:send_request).with('collection/new_collection')
160
+ expect(connection).to receive(:send_request).with('collection', post: { name: 'new_collection' })
161
+ expect(Ashikawa::Core::Collection).to receive(:new).with(subject, server_response('collections/60768679'))
213
162
 
214
163
  subject['new_collection']
215
164
  end
216
165
 
217
- it "should send a request via the connection object" do
218
- @connection.should_receive(:send_request).with("my/path", :post => { :data => "mydata" })
166
+ it 'should send a request via the connection object' do
167
+ expect(connection).to receive(:send_request)
168
+ .with('my/path', post: { data: 'mydata' })
219
169
 
220
- subject.send_request "my/path", :post => { :data => "mydata" }
170
+ subject.send_request 'my/path', post: { data: 'mydata' }
221
171
  end
222
172
 
223
- let(:js_function) { double }
224
- let(:collections) { double }
225
- let(:transaction) { double }
173
+ it 'should create a transaction' do
174
+ expect(Ashikawa::Core::Transaction).to receive(:new)
175
+ .with(subject, js_function, collections)
176
+ .and_return(transaction)
226
177
 
227
- it "should create a transaction" do
228
- Ashikawa::Core::Transaction.should_receive(:new).with(subject, js_function, collections).and_return { transaction }
229
- subject.create_transaction(js_function, collections).should == transaction
178
+ expect(subject.create_transaction(js_function, collections)).to be(transaction)
230
179
  end
231
180
  end
232
181
  end
@@ -1,112 +1,116 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  require 'unit/spec_helper'
2
3
  require 'ashikawa-core/document'
3
4
 
4
5
  describe Ashikawa::Core::Document do
5
6
  let(:database) { double }
6
- let(:raw_data) {
7
+ let(:id) { 164 }
8
+ let(:path) { 'document/164' }
9
+ let(:key) { double }
10
+ let(:revision) { double }
11
+ let(:first_name) { double }
12
+ let(:last_name) { double }
13
+ let(:more_info) { double }
14
+ let(:delete_payload) {{ delete: {} }}
15
+ let(:raw_data) do
7
16
  {
8
- "_id" => "1234567/2345678",
9
- "_key" => "2345678",
10
- "_rev" => "3456789",
11
- "first_name" => "The",
12
- "last_name" => "Dude"
17
+ '_id' => id,
18
+ '_key' => key,
19
+ '_rev' => revision,
20
+ 'first_name' => first_name,
21
+ 'last_name' => last_name
13
22
  }
14
- }
15
- let(:raw_data_without_id) {
23
+ end
24
+ let(:raw_data_without_id) do
16
25
  {
17
- "first_name" => "The",
18
- "last_name" => "Dude"
26
+ 'first_name' => first_name,
27
+ 'last_name' => last_name
19
28
  }
20
- }
21
- subject { Ashikawa::Core::Document }
22
-
23
- it "should initialize data with ID" do
24
- document = subject.new database, raw_data
25
- document.id.should == "1234567/2345678"
26
- document.key.should == "2345678"
27
- document.revision.should == "3456789"
28
29
  end
29
30
 
30
- it "should initialize data without ID" do
31
- document = subject.new database, raw_data_without_id
32
- document.id.should == :not_persisted
33
- document.revision.should == :not_persisted
34
- end
31
+ describe 'initializing' do
32
+ subject { Ashikawa::Core::Document }
35
33
 
36
- describe "initialized document with ID" do
37
- subject { Ashikawa::Core::Document.new database, raw_data }
34
+ let(:additional_data) do
35
+ {
36
+ more_info: more_info
37
+ }
38
+ end
38
39
 
39
- it "should return the correct value for an existing attribute" do
40
- subject["first_name"].should be(raw_data["first_name"])
40
+ it 'should initialize with data including ID' do
41
+ document = subject.new(database, raw_data)
42
+ expect(document.id).to eq(id)
43
+ expect(document.key).to eq(key)
44
+ expect(document.revision).to eq(revision)
41
45
  end
42
46
 
43
- it "should return nil for an non-existing attribute" do
44
- subject["no_name"].should be_nil
47
+ it 'should initialize with data not including ID' do
48
+ document = subject.new(database, raw_data_without_id)
49
+ expect(document.id).to eq(:not_persisted)
50
+ expect(document.revision).to eq(:not_persisted)
45
51
  end
46
52
 
47
- it "should be deletable" do
48
- database.should_receive(:send_request).with("document/#{raw_data['_id']}",
49
- { :delete => {} }
50
- )
53
+ it 'should initialize with additional data' do
54
+ document = subject.new(database, raw_data, additional_data)
55
+ expect(document['more_info']).to eq(more_info)
56
+ end
57
+ end
58
+
59
+ describe 'initialized document with ID' do
60
+ subject { Ashikawa::Core::Document.new(database, raw_data) }
61
+
62
+ let(:new_last_name) { double }
63
+ let(:raw_data_without_id_and_new_last_name) do
64
+ {
65
+ 'first_name' => first_name,
66
+ 'last_name' => new_last_name
67
+ }
68
+ end
51
69
 
70
+ its(['first_name']) { should be(first_name) }
71
+ its(['no_name']) { should be_nil }
72
+ its(:hash) { should be_instance_of Hash }
73
+ its(:hash) { should include('first_name' => first_name) }
74
+
75
+ it 'should be deletable' do
76
+ expect(database).to receive(:send_request).with(path, delete_payload)
52
77
  subject.delete
53
78
  end
54
79
 
55
- it "should store changes to the database" do
56
- database.should_receive(:send_request).with("document/#{raw_data['_id']}",
57
- { :put => { "first_name" => "The", "last_name" => "Other" } }
80
+ it 'should store changes to the database' do
81
+ expect(database).to receive(:send_request).with(path,
82
+ { put: raw_data_without_id_and_new_last_name }
58
83
  )
59
84
 
60
- subject["last_name"] = "Other"
85
+ subject['last_name'] = new_last_name
61
86
  subject.save
62
87
  end
63
88
 
64
- it "should be convertable to a hash" do
65
- hash = subject.hash
66
- hash.should be_instance_of Hash
67
- hash["first_name"].should == subject["first_name"]
68
- end
69
-
70
- it "should be refreshable" do
71
- database.should_receive(:send_request).with("document/#{raw_data['_id']}", {}).and_return {
72
- { "name" => "Jeff" }
89
+ it 'should be refreshable' do
90
+ expect(database).to receive(:send_request).with(path, {}).and_return {
91
+ { 'name' => 'Jeff' }
73
92
  }
74
93
 
75
94
  refreshed_subject = subject.refresh!
76
- refreshed_subject.should == subject
77
- subject["name"].should == "Jeff"
95
+ expect(refreshed_subject).to eq(subject)
96
+ expect(subject['name']).to eq('Jeff')
78
97
  end
79
98
  end
80
99
 
81
- describe "initialized document without ID" do
100
+ describe 'initialized document without ID' do
82
101
  subject { Ashikawa::Core::Document.new database, raw_data_without_id }
83
102
 
84
- it "should return the correct value for an existing attribute" do
85
- subject["first_name"].should be(raw_data_without_id["first_name"])
86
- end
87
-
88
- it "should return nil for an non-existing attribute" do
89
- subject["no_name"].should be_nil
90
- end
103
+ its(['first_name']) { should be(first_name) }
104
+ its(['no_name']) { should be_nil }
91
105
 
92
- it "should not be deletable" do
93
- database.should_not_receive :send_request
106
+ it 'should not be deletable' do
107
+ expect(database).not_to receive :send_request
94
108
  expect { subject.delete }.to raise_error Ashikawa::Core::DocumentNotFoundException
95
109
  end
96
110
 
97
- it "should not store changes to the database" do
98
- database.should_not_receive :send_request
111
+ it 'should not store changes to the database' do
112
+ expect(database).not_to receive :send_request
99
113
  expect { subject.save }.to raise_error Ashikawa::Core::DocumentNotFoundException
100
114
  end
101
115
  end
102
-
103
- describe "Deprecated methods" do
104
- subject { Ashikawa::Core::Document.new database, raw_data_without_id }
105
-
106
- it "should mark `to_hash` as deprecated" do
107
- subject.should_receive(:hash)
108
- subject.should_receive(:warn).with("`to_hash` is deprecated, please use `hash`")
109
- subject.to_hash
110
- end
111
- end
112
116
  end