Browse files

Add failing test for issue #259

  • Loading branch information...
1 parent 179a4d0 commit ae29e5577d2244c64e318d940780b6da6a7658be @norman committed May 21, 2012
Showing with 12 additions and 0 deletions.
  1. +12 −0 test/shared.rb
View
12 test/shared.rb
@@ -51,6 +51,18 @@ module Slugged
end
end
+ test "when validations block save, to_param should return friendly_id rather than nil" do
+ my_model_class = Class.new(model_class)
+ self.class.const_set("Foo", my_model_class)
+ with_instance_of my_model_class do |record|
+ record.update_attribute(my_model_class.friendly_id_config.slug_column, nil)
+ record = my_model_class.find(record.id)
+ record.class.validate Proc.new {errors[:name] = "FAIL"}
+ record.save
+ assert_equal record.to_param, record.friendly_id
+ end
+ end
+
end
module Core

0 comments on commit ae29e55

Please sign in to comment.