Sha256: c1e1276deba3725dc1fa2c4b2f4e8af13ce20f5acd60f13bd000aba489750ba5

Contents?: true

Size: 773 Bytes

Versions: 3

Compression:

Stored size: 773 Bytes

Contents

class TestDataset < Test::Unit::TestCase
  sub_test_case("#clear_cache!") do
    def setup
      @dataset = Datasets::Iris.new
      @cache_dir_path = @dataset.send(:cache_dir_path)
    end

    test("when the dataset is downloaded") do
      @dataset.first # This ensures the dataset downloaded
      existence = {before: @cache_dir_path.join("iris.csv").exist?}

      @dataset.clear_cache!
      existence[:after] = @cache_dir_path.join("iris.csv").exist?

      assert_equal({before: true, after: false},
                   existence)
    end

    test("when the dataset is not downloaded") do
      FileUtils.rmtree(@cache_dir_path.to_s, secure: true) if @cache_dir_path.exist?

      assert_nothing_raised do
        @dataset.clear_cache!
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
red-datasets-0.1.4 test/test-dataset.rb
red-datasets-0.1.3 test/test-dataset.rb
red-datasets-0.1.2 test/test-dataset.rb