Review Board 1.5.5

Ticket #608: Fixed failing tests related to "out_of" for GradeEntryItems

Updated 1 year, 11 months ago

Farah Juma Reviewers
markus_developers
608
None MarkUs Source Code Repository
Changing "out_of" to a float resulted in some unit and functional test failures related to grade entry items. The problem was that there was an "only_integer" check being done in grade_entry_item.rb.

I also migrated grade_entry_item_test.rb to Machinist.
All of the unit tests and functional tests now pass:

Units:
465 tests, 760 assertions, 0 failures, 0 errors

Functionals:
1131 tests, 1687 assertions, 0 failures, 0 errors
trunk/app/models/grade_entry_item.rb
Revision 1201 New Change
1
# GradeEntryItem represents column names (i.e. question names and totals) 
1
# GradeEntryItem represents column names (i.e. question names and totals) 
2
# in a grade entry form. 
2
# in a grade entry form. 
3
class GradeEntryItem < ActiveRecord::Base
3
class GradeEntryItem < ActiveRecord::Base
4
  belongs_to  :grade_entry_form
4
  belongs_to  :grade_entry_form
5
  
5
  
6
  has_many   :grades, :dependent => :destroy
6
  has_many   :grades, :dependent => :destroy
7
  has_many   :grade_entry_students, :through => :grades
7
  has_many   :grade_entry_students, :through => :grades
8
  
8
  
9
  validates_presence_of   :name
9
  validates_presence_of   :name
10
  validates_presence_of   :out_of
10
  validates_presence_of   :out_of
11
  
11
  
12
  validates_associated    :grade_entry_form
12
  validates_associated    :grade_entry_form
13
  
13
  
14
  validates_numericality_of :out_of, :only_integer => true,  :greater_than => 0, 
14
  validates_numericality_of :out_of, :greater_than => 0, 
15
                            :message => I18n.t('grade_entry_forms.invalid_column_out_of')                          
15
                            :message => I18n.t('grade_entry_forms.invalid_column_out_of')                          
16
  validates_uniqueness_of   :name, :scope => :grade_entry_form_id, 
16
  validates_uniqueness_of   :name, :scope => :grade_entry_form_id, 
17
                            :message => I18n.t('grade_entry_forms.invalid_name')
17
                            :message => I18n.t('grade_entry_forms.invalid_name')
18

   
18

   
19
end
19
end
trunk/test/unit/grade_entry_item_test.rb
Revision 1201 New Change
 
  1. trunk/app/models/grade_entry_item.rb: Loading...
  2. trunk/test/unit/grade_entry_item_test.rb: Loading...