Sha256: ef0ef3b65e97304e26f6b95f4fd565980ad94017b14e2500515924311f8eff8a

Contents?: true

Size: 1.07 KB

Versions: 25

Compression:

Stored size: 1.07 KB

Contents

require File.dirname(__FILE__) + '/test_helper'
require 'mofo/hcard'

module Formats
  class Card < HCard
  end
end

context "Subclassing an hCard" do
  specify "should parse a page with an hcard" do
    proc { Formats::Card.find(fixture(:fauxtank)) }.should.not.raise MicroformatNotFound
  end

  specify "should raise an error if no hcard is found in strict mode" do
    proc { Formats::Card.find(fixture(:fake), :strict => true) }.should.raise MicroformatNotFound
  end

  specify "should return an empty array if no hcard is found" do
    Formats::Card.find(fixture(:fake)).should.equal []
  end

  specify "should return nil if no hcard is found with :first" do
    Formats::Card.find(:first => fixture(:fake)).should.equal nil
  end

  specify "should return nil if no hcard is found with :all" do
    Formats::Card.find(:all => fixture(:fake)).should.equal []
  end

  specify "should accept a :text option" do
    Formats::Card.find(:text => open(fixture(:fauxtank)).read).should.not.equal []
    Formats::Card.find(:text => open(fixture(:fauxtank)).read).should.not.equal nil
  end
end

Version data entries

25 entries across 19 versions & 3 rubygems

Version Path
mofo-0.2.13 test/subclass_test.rb
mofo-0.2.14 ./test/subclass_test.rb
mofo-0.2.15 ./test/subclass_test.rb
mofo-0.2.9 test/subclass_test.rb
mofo-0.2.8 test/subclass_test.rb