##// END OF EJS Templates
back out r7450 and comment out "month_names" (#9298)...
back out r7450 and comment out "month_names" (#9298) *October* is missing. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7451 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r6652:cb78b6267e8a
r7331:a66f5c45d3bd
Show More
time_entry_activity_test.rb
85 lines | 2.9 KiB | text/x-ruby | RubyLexer
/ test / unit / time_entry_activity_test.rb
Toshi MARUYAMA
remove trailing white-spaces from test/unit/time_entry_activity_test.rb....
r6652 # Redmine - project management software
# Copyright (C) 2006-2011 Jean-Philippe Lang
Eric Davis
Changed Enumerations to use a Single Table Inheritance...
r2677 #
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
Toshi MARUYAMA
remove trailing white-spaces from test/unit/time_entry_activity_test.rb....
r6652 #
Eric Davis
Changed Enumerations to use a Single Table Inheritance...
r2677 # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
Toshi MARUYAMA
remove trailing white-spaces from test/unit/time_entry_activity_test.rb....
r6652 #
Eric Davis
Changed Enumerations to use a Single Table Inheritance...
r2677 # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Jean-Baptiste Barth
Use absolute paths in test/**/* requires for Ruby 1.9.2 compatibility. #4050...
r4395 require File.expand_path('../../test_helper', __FILE__)
Eric Davis
Changed Enumerations to use a Single Table Inheritance...
r2677
Eric Davis
Upgraded to Rails 2.3.4 (#3597)...
r2773 class TimeEntryActivityTest < ActiveSupport::TestCase
Eric Davis
Changed Enumerations to use a Single Table Inheritance...
r2677 fixtures :enumerations, :time_entries
def test_should_be_an_enumeration
assert TimeEntryActivity.ancestors.include?(Enumeration)
end
Toshi MARUYAMA
add functional tests for bulk edit time entries (#7996)....
r5195
Eric Davis
Changed Enumerations to use a Single Table Inheritance...
r2677 def test_objects_count
assert_equal 3, TimeEntryActivity.find_by_name("Design").objects_count
Toshi MARUYAMA
add functional tests for bulk edit time entries (#7996)....
r5195 assert_equal 2, TimeEntryActivity.find_by_name("Development").objects_count
Eric Davis
Changed Enumerations to use a Single Table Inheritance...
r2677 end
def test_option_name
assert_equal :enumeration_activities, TimeEntryActivity.new.option_name
end
Eric Davis
Enumerations can now have custom fields defined on them. #4077...
r2831
def test_create_with_custom_field
field = TimeEntryActivityCustomField.find_by_name('Billable')
e = TimeEntryActivity.new(:name => 'Custom Data')
e.custom_field_values = {field.id => "1"}
assert e.save
e.reload
assert_equal "1", e.custom_value_for(field).value
end
def test_create_without_required_custom_field_should_fail
field = TimeEntryActivityCustomField.find_by_name('Billable')
field.update_attribute(:is_required, true)
e = TimeEntryActivity.new(:name => 'Custom Data')
assert !e.save
assert_equal I18n.translate('activerecord.errors.messages.invalid'), e.errors.on(:custom_values)
end
def test_create_with_required_custom_field_should_succeed
field = TimeEntryActivityCustomField.find_by_name('Billable')
field.update_attribute(:is_required, true)
e = TimeEntryActivity.new(:name => 'Custom Data')
e.custom_field_values = {field.id => "1"}
assert e.save
end
def test_update_issue_with_required_custom_field_change
field = TimeEntryActivityCustomField.find_by_name('Billable')
field.update_attribute(:is_required, true)
e = TimeEntryActivity.find(10)
assert e.available_custom_fields.include?(field)
# No change to custom field, record can be saved
assert e.save
# Blanking custom field, save should fail
e.custom_field_values = {field.id => ""}
assert !e.save
assert e.errors.on(:custom_values)
Toshi MARUYAMA
remove trailing white-spaces from test/unit/time_entry_activity_test.rb....
r6652
Eric Davis
Enumerations can now have custom fields defined on them. #4077...
r2831 # Update custom field to valid value, save should succeed
e.custom_field_values = {field.id => "0"}
assert e.save
e.reload
assert_equal "0", e.custom_value_for(field).value
end
Eric Davis
Changed Enumerations to use a Single Table Inheritance...
r2677 end