A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://api.rubyonrails.org/classes/ActiveSupport/Testing/FileFixtures.html below:

Website Navigation


ActiveSupport::Testing::FileFixtures

Adds simple access to sample files called file fixtures. File fixtures are normal files stored in ActiveSupport::TestCase.file_fixture_path.

File fixtures are represented as Pathname objects. This makes it easy to extract specific information:

file_fixture("example.txt").read # get the file's content
file_fixture("example.mp3").size # get the file size

Methods

F
Instance Public methods file_fixture(fixture_name) Link

Returns a Pathname to the fixture file named fixture_name.

Raises ArgumentError if fixture_name can’t be found.

Source: show | on GitHub

def file_fixture(fixture_name)
  path = Pathname.new(File.join(file_fixture_path, fixture_name))

  if path.exist?
    path
  else
    msg = "the directory '%s' does not contain a file named '%s'"
    raise ArgumentError, msg % [file_fixture_path, fixture_name]
  end
end

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4