Method: Rails::Generators::Testing::Assertions#assert_no_file

Defined in:
railties/lib/rails/generators/testing/assertions.rb

#assert_no_file(relative) ⇒ Object Also known as: assert_no_directory

Asserts a given file does not exist. You need to supply an absolute path or a path relative to the configured destination:

assert_no_file "config/random.rb"
[View source]

45
46
47
48
# File 'railties/lib/rails/generators/testing/assertions.rb', line 45

def assert_no_file(relative)
  absolute = File.expand_path(relative, destination_root)
  assert !File.exists?(absolute), "Expected file #{relative.inspect} to not exist, but does"
end