Module: FileStubber

Defined in:
lib/generators/rider_kick/templates/spec/support/file_stuber.rb

Instance Method Summary collapse

Instance Method Details

#fixture_file(path, mime_type = nil, binary = false) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/generators/rider_kick/templates/spec/support/file_stuber.rb', line 4

def fixture_file(path, mime_type = nil, binary = false)
  config = RSpec.configuration

  if config.respond_to?(:fixture_paths) && config.fixture_paths && !File.exist?(path)
    path = File.join(config.fixture_paths, path)
  end

  Rack::Test::UploadedFile.new(path, mime_type, binary)
end