From 1180a94cf4b85db7dae6c3eadcdc109e1eadffd4 Mon Sep 17 00:00:00 2001 From: Michael Mitchell Date: Mon, 25 Mar 2013 15:52:51 -0700 Subject: [PATCH 1/3] defines the accesors on the singelton class only --- lib/microformats2/format.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/microformats2/format.rb b/lib/microformats2/format.rb index d06427e..0cd352f 100644 --- a/lib/microformats2/format.rb +++ b/lib/microformats2/format.rb @@ -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 From 87839c23ce70a1cc5bc8df19ca658c9de0992f11 Mon Sep 17 00:00:00 2001 From: Michael Mitchell Date: Mon, 25 Mar 2013 16:17:16 -0700 Subject: [PATCH 2/3] fixes specs calling now undefined methods --- Gemfile | 1 + spec/lib/microformats2/implied_property/photo_spec.rb | 2 +- spec/lib/microformats2/implied_property/url_spec.rb | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index fa64b65..63be373 100644 --- a/Gemfile +++ b/Gemfile @@ -2,3 +2,4 @@ source 'https://rubygems.org' # Specify your gem's dependencies in microformats2.gemspec gemspec +gem 'pry' diff --git a/spec/lib/microformats2/implied_property/photo_spec.rb b/spec/lib/microformats2/implied_property/photo_spec.rb index 8fbf886..f8a05b5 100644 --- a/spec/lib/microformats2/implied_property/photo_spec.rb +++ b/spec/lib/microformats2/implied_property/photo_spec.rb @@ -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 diff --git a/spec/lib/microformats2/implied_property/url_spec.rb b/spec/lib/microformats2/implied_property/url_spec.rb index 4447195..3c736f0 100644 --- a/spec/lib/microformats2/implied_property/url_spec.rb +++ b/spec/lib/microformats2/implied_property/url_spec.rb @@ -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 From 1accbfa2576078e054d8e8046687ad12469e3447 Mon Sep 17 00:00:00 2001 From: Michael Mitchell Date: Tue, 26 Mar 2013 07:14:34 -0700 Subject: [PATCH 3/3] removes straggling pry --- Gemfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Gemfile b/Gemfile index 63be373..fa64b65 100644 --- a/Gemfile +++ b/Gemfile @@ -2,4 +2,3 @@ source 'https://rubygems.org' # Specify your gem's dependencies in microformats2.gemspec gemspec -gem 'pry'