Commit c68b621ca8feb3a9f8b3d0ea83e171b334689d26

Authored by Rodrigo Souto
1 parent f1afd938

file-presenter: pass kind_of? to the encapsulated file

lib/file_presenter.rb
@@ -35,6 +35,10 @@ class FilePresenter @@ -35,6 +35,10 @@ class FilePresenter
35 self 35 self
36 end 36 end
37 37
  38 + def kind_of?(klass)
  39 + @file.kind_of?(klass)
  40 + end
  41 +
38 # This method must be overridden in subclasses. 42 # This method must be overridden in subclasses.
39 # 43 #
40 # If the class accepts the file, return a number that represents the 44 # If the class accepts the file, return a number that represents the
test/unit/file_presenter_test.rb
@@ -58,4 +58,8 @@ class FilePresenterTest < ActiveSupport::TestCase @@ -58,4 +58,8 @@ class FilePresenterTest < ActiveSupport::TestCase
58 end 58 end
59 end 59 end
60 60
  61 + should 'pass kind_of? to the encapsulated file' do
  62 + f = FilePresenter.for(UploadedFile.new)
  63 + assert f.kind_of?(UploadedFile)
  64 + end
61 end 65 end