Skip to content

Commit

Permalink
Fix assert argument order in texts so that failure messages make sense
Browse files Browse the repository at this point in the history
  • Loading branch information
Christos Zisopoulos committed Jul 11, 2009
1 parent ad607de commit 61423d1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/attribute_choices_test.rb
Expand Up @@ -56,30 +56,30 @@ class Person < ActiveRecord::Base

end

test "Multiple calls to attribute_choices update the attribute choices" do
test "Multiple calls to attribute_choices update the attribute choices" do
class Medic < Adult; end
assert_equal Medic.salutation_choices, [['Mister', 'mr'], ['Misses', 'mrs'], ["Miss", 'ms']]
assert_equal [['Mister', 'mr'], ['Misses', 'mrs'], ["Miss", 'ms']], Medic.salutation_choices

class Medic < Adult
attribute_choices :salutation, [ ["dr", 'Doctor'] ]
end

assert_equal Medic.salutation_choices, [ ['Doctor', 'dr'] ]
assert_equal [ ['Doctor', 'dr'] ], Medic.salutation_choices
end

test "It should store an options Hash if passed as the the optional third parameter" do
class Person < ActiveRecord::Base
attribute_choices :gender, {'m' => 'Male', 'f' => 'Female'}, :localize => true, :validate => false
end
assert_equal Person.attribute_choices_options[:gender], {:localize => true, :validate => false}
assert_equal Hash[:localize, true, :validate, false], Person.attribute_choices_options[:gender]
end

test "Default values are assigned for any options that are not specified" do
class Person < ActiveRecord::Base
attribute_choices :gender, {'m' => 'Male', 'f' => 'Female'}, :localize => true
end

assert_equal Person.attribute_choices_options[:gender], {:localize => true, :validate => false}
assert_equal Hash[:localize, true, :validate, false], Person.attribute_choices_options[:gender]
end

test "Doesn't validate inclusion of attribute value in choices values by default" do
Expand Down

0 comments on commit 61423d1

Please sign in to comment.