diff options
Diffstat (limited to 'test/rss/test_1.0.rb')
-rw-r--r-- | test/rss/test_1.0.rb | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/test/rss/test_1.0.rb b/test/rss/test_1.0.rb index 4b496adfcd..cb9f715eec 100644 --- a/test/rss/test_1.0.rb +++ b/test/rss/test_1.0.rb @@ -54,9 +54,6 @@ module RSS def test_channel about = "http://hoge.com" - title = "fugafuga" - link = "http://hoge.com" - description = "fugafugafugafuga" resource = "http://hoge.com/hoge.png" item_title = "item title" @@ -72,9 +69,18 @@ module RSS rss_item.link = item_link rss_item.about = item_link + h = { + 'title' => "fugafuga", + 'link' => "http://hoge.com", + 'description' => "fugafugafugafuga", + 'image' => image, + 'items' => items, + 'textinput' => textinput, + } + channel = RDF::Channel.new(about) %w(title link description image items textinput).each do |x| - channel.__send__("#{x}=", instance_eval(x)) + channel.__send__("#{x}=", h[x]) end doc = REXML::Document.new(make_RDF(<<-EOR)) @@ -96,7 +102,7 @@ EOR assert_equal(@rdf_uri, res.namespace) value = res.value else - excepted = instance_eval(x) + excepted = h[x] value = elem.text end assert_equal(excepted, value) @@ -199,13 +205,15 @@ EOR def test_image about = "http://hoge.com" - title = "fugafuga" - url = "http://hoge.com/hoge" - link = "http://hoge.com/fuga" + h = { + 'title' => "fugafuga", + 'url' => "http://hoge.com/hoge", + 'link' => "http://hoge.com/fuga", + } image = RDF::Image.new(about) %w(title url link).each do |x| - image.__send__("#{x}=", instance_eval(x)) + image.__send__("#{x}=", h[x]) end doc = REXML::Document.new(make_RDF(image.to_s)) @@ -216,19 +224,21 @@ EOR elem = i.elements[x] assert_equal(x, elem.name) assert_equal(@uri, elem.namespace) - assert_equal(instance_eval(x), elem.text) + assert_equal(h[x], elem.text) end end def test_item about = "http://hoge.com" - title = "fugafuga" - link = "http://hoge.com/fuga" - description = "hogehogehoge" + h = { + 'title' => "fugafuga", + 'link' => "http://hoge.com/fuga", + 'description' => "hogehogehoge", + } item = RDF::Item.new(about) %w(title link description).each do |x| - item.__send__("#{x}=", instance_eval(x)) + item.__send__("#{x}=", h[x]) end doc = REXML::Document.new(make_RDF(item.to_s)) @@ -239,20 +249,22 @@ EOR elem = i.elements[x] assert_equal(x, elem.name) assert_equal(@uri, elem.namespace) - assert_equal(instance_eval(x), elem.text) + assert_equal(h[x], elem.text) end end def test_textinput about = "http://hoge.com" - title = "fugafuga" - link = "http://hoge.com/fuga" - name = "foo" - description = "hogehogehoge" + h = { + 'title' => "fugafuga", + 'link' => "http://hoge.com/fuga", + 'name' => "foo", + 'description' => "hogehogehoge", + } textinput = RDF::Textinput.new(about) %w(title link name description).each do |x| - textinput.__send__("#{x}=", instance_eval(x)) + textinput.__send__("#{x}=", h[x]) end doc = REXML::Document.new(make_RDF(textinput.to_s)) @@ -263,7 +275,7 @@ EOR elem = t.elements[x] assert_equal(x, elem.name) assert_equal(@uri, elem.namespace) - assert_equal(instance_eval(x), elem.text) + assert_equal(h[x], elem.text) end end |