spec/support/shared.rb in permalink-1.2.0 vs spec/support/shared.rb in permalink-1.2.1
- old
+ new
@@ -90,6 +90,28 @@
record = model.create(:title => "Some nice post")
record.update_attributes :title => "Awesome post"
record.permalink.should == "awesome-post"
end
+
+ it "should force permalink and keep unique" do
+ model.permalink :title, :force => true, :unique => true
+
+ record = model.create(:title => "Some nice post")
+
+ record.update_attributes :title => "Awesome post"
+ record.permalink.should == "awesome-post"
+
+ record = model.create(:title => "Awesome post")
+ record.permalink.should == "awesome-post-2"
+ end
+
+ it "should keep same permalink when another field changes" do
+ model.permalink :title, :force => true, :unique => true
+
+ record = model.create(:title => "Some nice post")
+ record.update_attributes :description => "some description"
+
+ record.permalink.should == "some-nice-post"
+ end
+
end