test/test_finders.rb in sugarcrm-0.9.13 vs test/test_finders.rb in sugarcrm-0.9.14
- old
+ new
@@ -11,9 +11,27 @@
users = SugarCRM::User.find(:all, :conditions => {:user_name => '= invalid_user_123'})
assert_instance_of Array, users
assert users.length == 0
end
+ should "support finding first instance with default sort order (for module using date_entered as creation date)" do
+ expected_account = SugarCRM::Account.first({:order_by => 'date_entered'})
+ account = nil
+ assert_nothing_raised do
+ account = SugarCRM::Account.first
+ end
+ assert_equal expected_account.id, account.id
+ end
+
+ should "support finding first instance with default sort order (for module using date_created as creation date)" do
+ expected_email = SugarCRM::EmailAddress.first({:order_by => 'date_created'})
+ email = nil
+ assert_nothing_raised do
+ email = SugarCRM::EmailAddress.first
+ end
+ assert_equal expected_email.id, email.id
+ end
+
should "support finding first instance (sorted by attribute)" do
account = SugarCRM::Account.first({
:order_by => 'name'
})
assert_instance_of SugarCRM::Account, account
\ No newline at end of file