From c68b621ca8feb3a9f8b3d0ea83e171b334689d26 Mon Sep 17 00:00:00 2001 From: Rodrigo Souto Date: Mon, 10 Mar 2014 13:45:56 -0300 Subject: [PATCH] file-presenter: pass kind_of? to the encapsulated file --- lib/file_presenter.rb | 4 ++++ test/unit/file_presenter_test.rb | 4 ++++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/lib/file_presenter.rb b/lib/file_presenter.rb index 16db606..08c4d43 100644 --- a/lib/file_presenter.rb +++ b/lib/file_presenter.rb @@ -35,6 +35,10 @@ class FilePresenter self end + def kind_of?(klass) + @file.kind_of?(klass) + end + # This method must be overridden in subclasses. # # If the class accepts the file, return a number that represents the diff --git a/test/unit/file_presenter_test.rb b/test/unit/file_presenter_test.rb index 60f91aa..9b0d9f7 100644 --- a/test/unit/file_presenter_test.rb +++ b/test/unit/file_presenter_test.rb @@ -58,4 +58,8 @@ class FilePresenterTest < ActiveSupport::TestCase end end + should 'pass kind_of? to the encapsulated file' do + f = FilePresenter.for(UploadedFile.new) + assert f.kind_of?(UploadedFile) + end end -- libgit2 0.21.2