public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/zmack/mephisto.git
Tests for tag fix
zmack (author)
Wed Apr 23 02:23:07 -0700 2008
commit  781d35fee0f92028e52ea626c2b822c478fd329a
tree    a4c68c247294f9f502d020831499c5811e59e08e
parent  509fe7990f613dba50e6fe35d89d23ab6a41ad15
...
209
210
211
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
0
@@ -209,3 +209,42 @@ class ArticleFilterEditTest < Test::Unit::TestCase
0
     assert_equal @old_time, contents(:welcome_comment).reload.updated_at
0
   end
0
 end
0
+
0
+class ArticleTagsTest < Test::Unit::TestCase
0
+ def setup
0
+ @article = Article.create( :title => "Gasp, tag tester !", :filter => "markdown_filter", :site_id => 1, :user_id => 1 )
0
+ end
0
+
0
+ def test_should_not_screw_up_my_tags
0
+ @article.tag = '"my fish have plenty of tea"'
0
+ @article.save
0
+ assert_equal(1, @article.tags.reload.length)
0
+
0
+ @article.tag = @article.tag
0
+ @article.save
0
+
0
+ assert_equal(1, @article.tags.reload.length)
0
+ end
0
+
0
+ def test_should_wrap_multi_word_tags_in_quotes
0
+ @article.tag = '"my fish have plenty of tea"'
0
+ @article.save
0
+
0
+ assert_equal('"my fish have plenty of tea"', @article.reload.tag)
0
+ end
0
+
0
+ def test_should_not_wrap_if_there_are_other_tags_present
0
+ @article.tag = "my fish have plenty of tea, coffee"
0
+ @article.save
0
+
0
+ assert_equal("coffee, my fish have plenty of tea", @article.reload.tag)
0
+ end
0
+
0
+ def test_should_not_mess_with_normal_tags
0
+ @article.tag = "coffee"
0
+ @article.save
0
+
0
+ assert_equal("coffee", @article.reload.tag)
0
+ end
0
+
0
+end

Comments

    No one has commented yet.