neography-batch 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- neography-batch (1.0.1)
4
+ neography-batch (1.0.3)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -42,7 +42,7 @@ module Neography
42
42
  end
43
43
 
44
44
  def add(command_or_batch)
45
- if command_or_batch.class == Batch
45
+ if command_or_batch.kind_of?(Batch)
46
46
  bind(command_or_batch)
47
47
  else
48
48
  unless command_or_batch.respond_to?(:each)
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "neography-batch"
6
- s.version = "1.0.2"
6
+ s.version = "1.0.3"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = "Jorg Jenni"
9
9
  s.email = "jorg.jenni@jennius.co.uk"
data/spec/batch_spec.rb CHANGED
@@ -127,7 +127,6 @@ module Neography
127
127
 
128
128
  result1.should == result2
129
129
  end
130
-
131
130
  describe "and submit" do
132
131
  it "should combine separate batches into one batch" do
133
132
  batch1 = Batch.new(db)
@@ -203,6 +202,26 @@ module Neography
203
202
  subject.submit()
204
203
  end
205
204
  end
205
+ describe "add" do
206
+ context "with subclassed batch class" do
207
+ class SubclassedBatch < Batch
208
+ end
209
+ let(:batch) { Batch.new }
210
+ let(:subclassed_batch) { SubclassedBatch.new }
211
+
212
+ context "combines commands" do
213
+ before do
214
+ batch << [:create_node, {"id" => 2}]
215
+ subclassed_batch << [:create_node, {"id" => 45}]
216
+ end
217
+ it "combines commands" do
218
+ batch.add(subclassed_batch)
219
+ batch.should have(2).commands
220
+ end
221
+ end
222
+
223
+ end
224
+ end
206
225
  describe "add and submit" do
207
226
  it "should raise exception when added element doesn't respond to :each" do
208
227
  -> { subject.add(1) }.should raise_exception(StandardError)
@@ -231,7 +250,7 @@ module Neography
231
250
  subject.submit()
232
251
  end
233
252
 
234
- context "when list 2 commands" do
253
+ context "list contains 2 commands" do
235
254
  before do
236
255
  @john = subject.add [:create_node]
237
256
  @markus = subject.add [:create_node]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neography-batch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: