spec/set_spec.rb in restruct-0.0.3 vs spec/set_spec.rb in restruct-0.1.0

- old
+ new

@@ -5,11 +5,11 @@ describe klass do let(:set) { klass.new } def fill(elements) - redis.call 'SADD', set.id, *(elements.map { |e| set.send(:serialize, e) }) + connection.call 'SADD', set.id, *(elements.map { |e| set.send(:serialize, e) }) end describe 'Setters' do %w(add <<).each do |method| @@ -248,9 +248,26 @@ other = klass.new other.restore dump other.id.wont_equal set.id other.to_primitive.must_equal set.to_primitive + end + + it 'Batch' do + fill %w(a b c) + + set.connection.batch do + set.add 'd' #a b c d + set.add? 'x' #a b c d x + set.delete 'b' #a c d x + set.subtract %w(c d) #a x + set.merge %w(x y z) #a x y z + set.delete? 'a' #x y z + + set.to_a.must_equal_contents %w(a b c) + end + + set.to_a.must_equal_contents %w(x y z) end end end \ No newline at end of file