Sha256: dfc54a35095d2c6c3059fa0a480ed0b19fab3c3ee2fb11f97929b860bd4ceb9d
Contents?: true
Size: 1.11 KB
Versions: 14
Compression:
Stored size: 1.11 KB
Contents
require 'spec_helper' describe Ardm::Property::Binary do before do @name = :title @type = described_class @load_as = String @value = 'value' @other_value = 'return value' @invalid_value = 1 end it_should_behave_like 'A public Property' describe '.options' do subject { described_class.options } it { is_expected.to be_kind_of(Hash) } it { is_expected.to eql(:load_as => @load_as, :dump_as => @load_as, :coercion_method => :to_string, :length => 50) } end if RUBY_VERSION >= "1.9" describe 'encoding' do let(:model) do Class.new(::Ardm::Record) do self.table_name = "articles" # co-opt the articles table property :bin_data, ::Ardm::Property::Binary, :field => 'body' end end it 'should always dump with BINARY' do expect(model.properties[:bin_data].dump("foo".freeze).encoding.names).to include("BINARY") end it 'should always load with BINARY' do expect(model.properties[:bin_data].load("foo".freeze).encoding.names).to include("BINARY") end end end end
Version data entries
14 entries across 14 versions & 1 rubygems