test/ruby_test.rb in data_cleansing-0.3.2 vs test/ruby_test.rb in data_cleansing-0.4.0
- old
+ new
@@ -68,9 +68,16 @@
should 'have globally registered cleaner' do
assert DataCleansing.cleaner(:strip)
end
+ should 'Model.cleanse_attribute' do
+ assert_equal 'male', RubyUserChild.cleanse_attribute(:gender, "\n Male \n"), RubyUserChild.send(:data_cleansing_attribute_cleaners)
+ assert_equal 'joe', RubyUserChild.cleanse_attribute(:first_name, ' joe '), RubyUserChild.send(:data_cleansing_attribute_cleaners)
+ assert_equal 'black', RubyUserChild.cleanse_attribute(:last_name, "\n black\n"), RubyUserChild.send(:data_cleansing_attribute_cleaners)
+ assert_equal '<< 2632 Brown St >>', RubyUserChild.cleanse_attribute(:address1, "2632 Brown St \n"), RubyUserChild.send(:data_cleansing_attribute_cleaners)
+ end
+
context "with ruby user" do
setup do
@user = RubyUser.new
@user.first_name = ' joe '
@user.last_name = "\n black\n"
\ No newline at end of file