Skip to content

Commit

Permalink
Add failing test for issue #259
Browse files Browse the repository at this point in the history
  • Loading branch information
norman committed May 21, 2012
1 parent 179a4d0 commit ae29e55
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/shared.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ae29e55

Please sign in to comment.