Class: SibaTest::FileMock

Inherits:
Object
  • Object
show all
Defined in:
lib/siba/helpers/test/file_mock.rb

Overview

mocks all Siba::SibaFile methods

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/siba/helpers/test/file_mock.rb', line 6

def method_missing(meth, *args, &block)
  if FileMock.method_defined? meth
    # do nothing
  else
    super
  end
end

Class Method Details

.mock_all_methodsObject



22
23
24
# File 'lib/siba/helpers/test/file_mock.rb', line 22

def self.mock_all_methods
  Siba::FilePlug.siba_file = SibaTest::FileMock.new
end

Instance Method Details

#file_expand_path(file_name) ⇒ Object



26
27
28
# File 'lib/siba/helpers/test/file_mock.rb', line 26

def file_expand_path(file_name)
  file_name
end

#respond_to?(meth) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
18
19
20
# File 'lib/siba/helpers/test/file_mock.rb', line 14

def respond_to?(meth)
  if FileMock.method_defined? meth
    true
  else
    super
  end
end