File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -734,6 +734,7 @@ cb_Backend_document_append(VALUE self,
734734 cb_extract_content (req, content);
735735 cb_extract_timeout (req, options);
736736 cb_extract_durability_level (req, options);
737+ cb_extract_cas (req, options);
737738
738739 auto parent_span = cb_create_parent_span (req, self);
739740
@@ -807,6 +808,7 @@ cb_Backend_document_prepend(VALUE self,
807808 cb_extract_content (req, content);
808809 cb_extract_timeout (req, options);
809810 cb_extract_durability_level (req, options);
811+ cb_extract_cas (req, options);
810812
811813 auto parent_span = cb_create_parent_span (req, self);
812814
Original file line number Diff line number Diff line change @@ -818,6 +818,28 @@ def test_prepend_with_durability
818818 assert_equal "barfoo" , res . content
819819 end
820820
821+ def test_append_with_bad_cas
822+ doc_id = uniq_id ( :append )
823+
824+ res = @collection . upsert ( doc_id , "foo" , Options ::Upsert ( transcoder : RawBinaryTranscoder . new ) )
825+
826+ refute_equal 0 , res . cas
827+ assert_raises ( Couchbase ::Error ::CasMismatch ) do
828+ @collection . binary . append ( doc_id , "bar" , Options ::Append ( cas : res . cas + 1 ) )
829+ end
830+ end
831+
832+ def test_prepend_with_bad_cas
833+ doc_id = uniq_id ( :prepend )
834+
835+ res = @collection . upsert ( doc_id , "foo" , Options ::Upsert ( transcoder : RawBinaryTranscoder . new ) )
836+
837+ refute_equal 0 , res . cas
838+ assert_raises ( Couchbase ::Error ::CasMismatch ) do
839+ @collection . binary . prepend ( doc_id , "bar" , Options ::Prepend ( cas : res . cas + 1 ) )
840+ end
841+ end
842+
821843 def test_multi_ops
822844 skip ( "#{ name } : The #{ Couchbase ::Protostellar ::NAME } protocol does not support multi ops" ) if env . protostellar?
823845
You can’t perform that action at this time.
0 commit comments