Changeset 108
- Timestamp:
- 06/13/08 22:45:19 (5 months ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
app/models/configuration_parameter.rb (modified) (1 diff)
-
test/unit/configuration_parameter_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/models/configuration_parameter.rb
r51 r108 11 11 def validate 12 12 self.errors.add('value', 'must be empty if prompt on deploy is set') if (self.prompt? && !self.value.blank?) 13 self.errors.add('name', 'can\'t contain a colon') if (!self.name.blank? && self.name.strip.starts_with?(":")) 13 14 end 14 15 -
trunk/test/unit/configuration_parameter_test.rb
r1 r108 168 168 end 169 169 170 def test_should_not_be_valid_when_name_starts_with_colon 171 c = @project.configuration_parameters.build( 172 :name => ':password_2', 173 :value => 'abc', 174 :prompt_on_deploy => 0 175 ) 176 c.valid? 177 assert_equal "can't contain a colon", c.errors.on(:name) 178 end 179 180 def test_should_not_be_valid_when_name_starts_with_spaces_and_colon 181 c = @project.configuration_parameters.build( 182 :name => ' :password_2', 183 :value => 'abc', 184 :prompt_on_deploy => 0 185 ) 186 c.valid? 187 assert_equal "can't contain a colon", c.errors.on(:name) 188 end 189 170 190 end
