Merge pull request #2 from G5/singleton-class
defines the accesors on the singelton class only
This commit is contained in:
commit
28badd2f23
3 changed files with 4 additions and 4 deletions
|
@ -89,10 +89,10 @@ module Microformats2
|
|||
|
||||
def define_method(mn)
|
||||
unless respond_to?(mn)
|
||||
self.class.class_eval { attr_accessor mn }
|
||||
self.singleton_class.class_eval { attr_accessor mn }
|
||||
end
|
||||
unless respond_to?(mn.pluralize)
|
||||
self.class.class_eval { attr_accessor mn.pluralize }
|
||||
self.singleton_class.class_eval { attr_accessor mn.pluralize }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ describe Microformats2::ImpliedProperty::Photo do
|
|||
end
|
||||
collection.all.each_with_index do |format, index|
|
||||
it "implies photo to be '' in case #{index+1}" do
|
||||
format.photo.to_s.should == ""
|
||||
expect {format.photo}.to raise_error(NoMethodError)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,7 +23,7 @@ describe Microformats2::ImpliedProperty::Url do
|
|||
end
|
||||
collection.all.each_with_index do |format, index|
|
||||
it "implies url to be '' in case #{index+1}" do
|
||||
format.url.to_s.should == ""
|
||||
expect {format.url.to_s.should == ""}.to raise_error(NoMethodError)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue