diff options
-rw-r--r-- | lib/puppet/network/format.rb | 3 | ||||
-rwxr-xr-x | spec/unit/network/format.rb | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/puppet/network/format.rb b/lib/puppet/network/format.rb index 5f259fa49..3e0a7d8aa 100644 --- a/lib/puppet/network/format.rb +++ b/lib/puppet/network/format.rb @@ -55,7 +55,8 @@ class Puppet::Network::Format end def supported?(klass) - klass.respond_to?(intern_method) and + suitable? and + klass.respond_to?(intern_method) and klass.respond_to?(intern_multiple_method) and klass.respond_to?(render_multiple_method) and klass.instance_methods.include?(render_method) diff --git a/spec/unit/network/format.rb b/spec/unit/network/format.rb index b960a3f73..818ecdce3 100755 --- a/spec/unit/network/format.rb +++ b/spec/unit/network/format.rb @@ -74,6 +74,11 @@ describe Puppet::Network::Format do Puppet::Network::Format.new(:yaml).should_not be_supported(String) end + it "should not consider a class supported unless the format is suitable" do + @format.expects(:suitable?).returns false + @format.should_not be_supported(FormatRenderer) + end + it "should always downcase mimetypes" do @format.mime = "Foo/Bar" @format.mime.should == "foo/bar" |