Sha256: 1a0c56a82045771e5ef36385a6cc03f41e0a7df4cbf5930cdcad96508b02ef25

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

require "abstract_unit"

require "pathname"

class FileFixturesTest < ActiveSupport::TestCase
  self.file_fixture_path = File.expand_path("../file_fixtures", __dir__)

  test "#file_fixture returns Pathname to file fixture" do
    path = file_fixture("sample.txt")
    assert_kind_of Pathname, path
    assert_match %r{.*/test/file_fixtures/sample\.txt$}, path.to_s
  end

  test "raises an exception when the fixture file does not exist" do
    e = assert_raises(ArgumentError) do
      file_fixture("nope")
    end
    assert_match(/^the directory '[^']+test\/file_fixtures' does not contain a file named 'nope'$/, e.message)
  end
end

class FileFixturesPathnameDirectoryTest < ActiveSupport::TestCase
  self.file_fixture_path = Pathname.new(File.expand_path("../file_fixtures", __dir__))

  test "#file_fixture_path returns Pathname to file fixture" do
    path = file_fixture("sample.txt")
    assert_kind_of Pathname, path
    assert_match %r{.*/test/file_fixtures/sample\.txt$}, path.to_s
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-on-quails-0.1.0 activesupport/test/testing/file_fixtures_test.rb