OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/vendor/plugins/acts_as_journalized/test/users_test.rb

26 lines
826 B

#-- encoding: UTF-8
require 'test_helper'
class UsersTest < Test::Unit::TestCase
context 'The user responsible for an update' do
setup do
@updated_by = User.create(:name => 'Steve Jobs')
@user = User.create(:name => 'Steve Richert')
end
should 'default to nil' do
@user.update_attributes(:first_name => 'Stephen')
assert_nil @user.journals.last.user
end
should 'accept and return an ActiveRecord user' do
@user.update_attributes(:first_name => 'Stephen', :updated_by => @updated_by)
assert_equal @updated_by, @user.journals.last.user
end
should 'accept and return a string user name' do
@user.update_attributes(:first_name => 'Stephen', :updated_by => @updated_by.name)
assert_equal @updated_by.name, @user.journals.last.user
end
end
end