Sha256: b21953bb8800bc06cad3d85c914eb6c3ec15bfe58b465c39531d2ac9d619a758
Contents?: true
Size: 956 Bytes
Versions: 2
Compression:
Stored size: 956 Bytes
Contents
require 'spec_helper' describe 'Sequel::Plugins::StringCleaner' 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_cleaner end it 'cleans word' do expected = 'something' subject.name = "\xC2\xA0 #{expected}\xC2\xA0 " subject.name.must_equal expected end it 'doesnt touch inner characters' do expected = "some \t \xC2\xA0 \n thing" subject.name = "\xC2\xA0 #{expected}\xC2\xA0 " subject.name.must_equal expected end it 'doesnt affect non-string inputs' do expected = rand_i subject.name = expected subject.name.must_equal expected end it 'doesnt blob alone' do expected = Sequel.blob " #{rand_s} " 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_cleaner_spec.rb |
sequel-enhancements-0.2.0 | spec/plugins/string_cleaner_spec.rb |