Sha256: e5a9e93d596ec2bd34fb164c10df709c40278eacf42142655903b8fc8a12d12e
Contents?: true
Size: 931 Bytes
Versions: 2
Compression:
Stored size: 931 Bytes
Contents
require 'spec_helper' describe Cassandra::Mapper::Convert do context 'uuid' do let(:time) { Time.now.round } it '#to' do subject.to(:uuid, time).should have(16).bytes end it '#from' do uuid = subject.to(:uuid, time) subject.from(:uuid, uuid).should == time end end context 'integer' do let(:number) { 17 } let(:cassandra_format) { "\x00\x00\x00\x11" } it '#to' do subject.to(:integer, number).should == cassandra_format end it '#from' do subject.from(:integer, cassandra_format) == number end end context 'time' do context 'empty' do it '#to' do expect { subject.to(:time, '') }.to raise_error(ArgumentError) end end let(:time) { Time.at((Time.now.to_f * 1000).to_i / 1000) } it '#from' do formatted = subject.to(:time, time) subject.from(:time, formatted).should == time end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cassandra-mapper-0.2 | spec/cassandra/mapper/convert_spec.rb |
cassandra-mapper-0.1 | spec/cassandra/mapper/convert_spec.rb |