organizes specs

This commit is contained in:
Jessica Lynn Suttles 2013-02-12 12:56:39 -08:00
parent c74ecef194
commit 83b469597f
4 changed files with 20 additions and 20 deletions

View file

@ -19,7 +19,7 @@ describe Microformats2 do
Microformats2.read_html(@html).should include @html
end
it "can be a file path to html" do
html = "spec/support/simple_hcard.html"
html = "spec/support/hcard-simple.html"
Microformats2.read_html(html).should include "<div class=\"h-card\">"
end
it "can be a url to html" do
@ -27,19 +27,4 @@ describe Microformats2 do
Microformats2.read_html(html).should include "google"
end
end
describe "programatic case" do
cases_dir = "spec/support/cases/microformats.org/microformats-2"
html_files = Dir.entries(cases_dir).keep_if { |f| f =~ /([.]html$)/ }
html_files.each do |html_file|
it "#{html_file}" do
json_file = html_file.gsub(/([.]html$)/, ".js")
html = open(File.join(cases_dir, html_file)).read
json = open(File.join(cases_dir, json_file)).read
JSON.parse(Microformats2.parse(html).to_json).should == JSON.parse(json)
end
end
end
end