Sha256: cbe90d65070e77e4cc4f87e7ea21020585a90a5b7b6be8379b8bc7b7c610e8f5
Contents?: true
Size: 974 Bytes
Versions: 2
Compression:
Stored size: 974 Bytes
Contents
require 'spec_helper' describe 'Sequel::Plugins::StringDowncaser' do let(:db){ Sequel.mock } let(:model_class){ Class.new(Sequel::Model(db[:test])){ @plugins.clear } } subject { model_class.new } before do model_class.columns :name, :other model_class.plugin :string_downcaser, :name end it 'downcases specified column' do expected = rand_s subject.name = expected.upcase subject.name.must_equal expected end it 'doesnt affect unspecified columns' do expected = rand_s.upcase subject.other = expected subject.other.must_equal expected end it 'handles nil value' do subject.name = nil subject.name.must_be_nil end it 'handles non-string value' do subject.name = 7 subject.name.must_equal 7 end it 'leaves blob alone' do expected = Sequel.blob rand_s.upcase subject.name = expected subject.name.must_be_instance_of Sequel::SQL::Blob subject.name.must_equal expected end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sequel-enhancements-0.3.0 | spec/plugins/string_downcaser_spec.rb |
sequel-enhancements-0.2.0 | spec/plugins/string_downcaser_spec.rb |