class TestModulobeModel
Public Instance Methods
test_all()
click to toggle source
# File vendor/qwik/lib/qwik/modulobe.rb, line 317 def test_all t_add_user page = @site['_SiteConfig'] page.store(':siteurl:http://wiki.example.com/') page = @site.create('c') page.store('') files = @site.files('c') files.put('test1.mdlb', MODULOBE_TEST_MODEL1, nil, 0) files.put('test1.gif', TEST_PNG_DATA, nil, 1) file = files.path('test1.mdlb') # test_create_model model = Modulobe::ModelFile.new(file) ok_eq('.test/data/test/c.files/test1.mdlb', model.file.to_s) ok_eq(Time.at(0), model.mtime) ok_eq(563, model.length) ok_eq('.test/data/test/c.files/test1.gif', model.image_file.to_s) # test_internal_info ok_eq(nil, model.name) # test_prepare_metadata name, author, comment = model.prepare_metadata ok_eq('test1', name) ok_eq('anonymous', author) ok_eq('', comment) # test_get_internal_info name, author, comment = model.get_internal_info ok_eq('t1 model', name) ok_eq('Alice', author) ok_eq('This is a comment. ', comment) session('/test/c.html') # for create @action # test_modulobe_model_link file, relative = @action.modulobe_model_link(model.file) ok_eq('c.files/test1.mdlb', relative) ok_eq('/c.files/test1.mdlb', @action.c_relative_to_root(relative)) ok_eq('http://wiki.example.com/c.files/test1.mdlb', @action.c_relative_to_absolute(relative)) # test_modulobe_image_link file, relative = @action.modulobe_image_link(model.file) ok_eq('.test/data/test/c.files/test1.gif', file.to_s) ok_eq('c.files/test1.gif', relative) # test_modulobe_thumb_link file, relative = @action.modulobe_thumb_link(model.file) ok_eq('.test/data/test/c.files/.thumb/test1.gif', file.to_s) ok_eq('c.files/.thumb/test1.gif', relative) path = 'c.files' ok_eq([:tr, {:class=>'model'}, [:td, [:a, {:href=>'c.files/test1.mdlb'}, [:img, {:src=>'c.files/.thumb/test1.gif'}]]], [:td, [:div, {:class=>'author'}, 'Alice'], [:div, {:class=>'name'}, [:a, {:href=>'c.files/test1.mdlb'}, 't1 model']], [:pre, {:class=>'comment'}, 'This is a comment. ']]], model.create_entry(@action, path)) ok_eq([:a, {:href=>'c.files/test1.mdlb'}, [:img, {:src=>'c.files/.thumb/test1.gif'}]], model.create_model_entry(@action, path)) ok_eq([:item, [:title, 't1 model'], [:link, 'http://wiki.example.com/c.files/test1.mdlb'], [:description, "<p><img src=\"http://wiki.example.com/c.files/.thumb/test1.gif\" alt=\"t1 model\" width=\"100\" height=\"75\"/><br/>This is a comment.\n</p>"], [:author, 'Alice'], [:pubDate, 'Thu, 01 Jan 1970 09:00:00 GMT'], [:enclosure, {:length=>563, :type=>'application/xml', :url=>'http://wiki.example.com/c.files/test1.mdlb'}], [:'creativeCommons:license', 'http://creativecommons.org/licenses/by-sa/2.5/deed.ja']], model.create_rss_item(@action, path)) end