Skip to content

Commit

Permalink
fix if tag don't have expected attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Paxa committed Nov 16, 2011
1 parent b31072d commit 60d0ac1
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/mida/itemprop.rb
Expand Up @@ -77,8 +77,9 @@ def extract_property_value
element = @element.name
if non_textcontent_element?(element)
attribute = NON_TEXTCONTENT_ELEMENTS[element]
value = @element.attribute(attribute).value
url_attribute?(attribute) ? make_absolute_url(value) : value
if attribute_node = @element.attribute(attribute)
url_attribute?(attribute) ? make_absolute_url(attribute_node.value) : attribute_node.value
end
else
@element.inner_text.strip
end
Expand Down
27 changes: 27 additions & 0 deletions spec/fixtures/Cut the Rope - Android Market.html

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions spec/fixtures_spec.rb
@@ -0,0 +1,15 @@
require 'spec_helper'
require 'mida'
require 'pathname'

describe Mida do
it "should work with all fixtures" do
url = "https://market.android.com/details?id=com.zeptolab.ctr.paid&hl=en"

documents = Pathname.new(__FILE__).dirname.join('fixtures').children
documents.each do |file|
doc = Mida::Document.new(file.read, url)
doc.items.should_not be_empty
end
end
end

0 comments on commit 60d0ac1

Please sign in to comment.