module TestBench::Fixture::Controls::TestFile

Public Class Methods

directory() click to toggle source
# File lib/test_bench/fixture/controls/test_file.rb, line 33
def self.directory
  '/tmp'
end
example(filename: nil, text: nil, directory: nil) click to toggle source
# File lib/test_bench/fixture/controls/test_file.rb, line 5
def self.example(filename: nil, text: nil, directory: nil)
  filename ||= self.filename
  text ||= self.text
  directory ||= self.directory

  basename, extension, _ = filename.partition('.rb')

  file = Tempfile.new([basename, extension], directory)
  file.write(text)
  file.close

  tempfiles << file

  file.path
end
filename() click to toggle source
# File lib/test_bench/fixture/controls/test_file.rb, line 21
def self.filename
  'some_test_file.rb'
end
path() click to toggle source
# File lib/test_bench/fixture/controls/test_file.rb, line 25
def self.path
  "test/automated/#{filename}"
end
tempfiles() click to toggle source
# File lib/test_bench/fixture/controls/test_file.rb, line 37
def self.tempfiles
  @tempfiles ||= []
end
text() click to toggle source
# File lib/test_bench/fixture/controls/test_file.rb, line 29
def self.text
  '# Nothing'
end