Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added test for nil attributes

  • Loading branch information...
commit 23bab69376c9dfb8b85a57e2fd209a2e42ca185b 1 parent 7a1cb2b
@phene phene authored committed
Showing with 13 additions and 0 deletions.
  1. +13 −0 test/acts_as_stripped_test.rb
View
13 test/acts_as_stripped_test.rb
@@ -34,6 +34,19 @@ class ActsAsStrippedTest < Test::Unit::TestCase
assert_equal 'ryan', @user.first_name
assert_equal 'sonnek', @user.last_name
end
+
+ should "not fail if any attributes are nil" do
+ @user.first_name = ' shaq '
+ @user.last_name = nil
+ @user.logged_in_at = Time.now
+
+ assert_nothing_raised do
+ @user.save!
+ end
+
+ assert_equal 'shaq', @user.first_name
+ assert_nil @user.last_name
+ end
end
context 'a basic post instance' do
Please sign in to comment.
Something went wrong with that request. Please try again.