spec/lib/slug_spec.rb in wulffeld_slug-0.0.19 vs spec/lib/slug_spec.rb in wulffeld_slug-0.0.20

- old
+ new

@@ -46,6 +46,48 @@ user = User.new(:login => "deckard") user.save! user.reload.slug.should == 'deckard' end end + + context "transliteration" do + it "should transliterate Danish" do + article = Article.new(:title => "Rådhusstræde") + article.valid? + article.slug.should == "radhusstraede" + end + + it "should transliterate Danish with a hint" do + article = Article.new(:title => "Rådhusstræde") + article.class_eval do + def slug_kinds + :danish + end + end + article.valid? + article.slug.should == "raadhusstraede" + end + + it "should transliterate German" do + article = Article.new(:title => "Jürgen Müller") + article.valid? + article.slug.should == "jurgen-muller" + end + + it "should transliterate German with a hint" do + article = Article.new(:title => "Jürgen Müller") + article.class_eval do + def slug_kinds + :german + end + end + article.valid? + article.slug.should == "juergen-mueller" + end + + it "should transliterate Russian" do + article = Article.new(:title => "Дворец Спорта") + article.valid? + article.slug.should == "dvorec-sporta" + end + end end