Make test 2.0 compatible

Change-Id: If857f16024a82dd0cc3e7cbf3833c05f1597c427
Reviewed-on: http://review.couchbase.org/25939
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Deprecate numeric argument to for 'default_format'

It will warn when the application will pass numeric representation of
the flags to 'default_format'.

Old:

    Couchbase.connect(:default_format => Couchbase::Bucket::FMT_MARSHAL)

New:

    Couchbase.connect(:default_format => :marshal)
    Couchbase.connect(:transcoder => Couchbase::Transcoder::Marshal)

Change-Id: Ic25c6e584820b39c89253ac63e57f5923b867918
Reviewed-on: http://review.couchbase.org/25940
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Use constants instead of magic numbers

Change-Id: I14141359aecbe30e5b8a2576407d2e5072110e8f
Reviewed-on: http://review.couchbase.org/25941
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
rb_obj_is_kind_of() returns ruby boolean and must be converted

Change-Id: I116d845a165b36ceab4d49963a2c4fa574de7b1b
Implement Transcoders

Transcoder could be any entity which responds to #load and #dump

For example, this is how simple data transcoder, which use Zlib to
compress documents, will look like:

  class ZlibTranscoder
    FMT_ZLIB = 0x04

    def initialize(base)
      @base = base
    end

    def dump(obj, flags, options = {})
      obj, flags = @base.dump(obj, flags, options)
      z = Zlib::Deflate.new(Zlib::BEST_SPEED)
      buffer = z.deflate(obj, Zlib::FINISH)
      z.close
      [buffer, flags|FMT_ZLIB]
    end

    def load(blob, flags, options = {})
      # decompress value only if Zlib flag set
      if (flags & FMT_ZLIB) == FMT_ZLIB
        z = Zlib::Inflate.new
        blob = z.inflate(blob)
        z.finish
        z.close
      end
      @base.load(blob, flags, options)
    end
  end

Change-Id: I0e983c996e28e396132b30a8659ad4fbba44ba3d