Project

General

Profile

Defect #15551 ยป Defect15551.diff

Guido Heymann, 2013-11-27 22:28

View differences:

app/models/setting.rb (Arbeitskopie)
83 83

  
84 84
  validates_uniqueness_of :name
85 85
  validates_inclusion_of :name, :in => @@available_settings.keys
86
  validates_numericality_of :value, :only_integer => true, :if => Proc.new { |setting| @@available_settings[setting.name]['format'] == 'int' }
86
  validates_numericality_of :value, :only_integer => true, :if => Proc.new { |setting| @@available_settings.has_key?(setting) ? @@available_settings[setting.name]['format'] == 'int' : false}
87 87

  
88 88
  # Hash used to cache setting values
89 89
  @cached_settings = {}
test/unit/setting_test.rb (Arbeitskopie)
87 87
      assert_equal [10, 25, 50], Setting.per_page_options_array
88 88
    end
89 89
  end
90

  
91
  def test_insert_name_not_in_settings_yml
92
    setting  = Setting.new(:name => "does_not_exist", :value => "should_not_be_allowed" )
93
    assert !setting.save
94
  end
90 95
end
    (1-1/1)