InvalidPropertyPrefix error class

Raise a InvalidPropertyPrefix error if the prefix is invalid.
This commit is contained in:
Michael Mitchell + Chris Stringer 2013-03-22 16:03:51 -07:00 committed by Jessica Lynn Suttles
parent e8be12b66e
commit e8d9e77e41
3 changed files with 12 additions and 3 deletions

View file

@ -76,17 +76,22 @@ describe Microformats2::Collection do
describe "Format.add_property" do
let(:value) { "bar" }
before do
@collection.first.add_property("p-foo", value)
end
it "creates the attr" do
@collection.first.add_property("p-foo", value)
@collection.first.foo.to_s.should == value
end
it "allows json output of the attribute" do
@collection.first.add_property("p-foo", value)
@collection.first.to_json.should include(value)
end
it "raises a InvalidPropertyPrefix error if the prefix is invalid" do
expect {
@collection.first.add_property("xxx-foo", value)
}.to raise_error Microformats2::InvalidPropertyPrefix
end
end
end