Sha256: 25a0d084f313bff57b4f49ee910456909c8c16901be3a1ddf273494b2d92645b

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require 'assert'
require 'fileutils'
require 'dassets'

module Dassets

  class BaseTests < Assert::Context
    desc "Dassets"
    subject{ Dassets }

    should have_imeths :config, :configure, :init, :[]
    should have_imeths :source_list

    should "return a `Config` instance with the `config` method" do
      assert_kind_of Config, subject.config
    end

    should "return asset files given a their digest path using the index operator" do
      file = subject['nested/file3.txt']

      assert_kind_of Dassets::AssetFile, file
      assert_equal 'nested/file3.txt', file.digest_path
      assert_equal 'd41d8cd98f00b204e9800998ecf8427e', file.fingerprint
    end

    should "return an asset file that doesn't exist if digest path not found" do
      file = subject['path/not/found.txt']
      assert_not file.exists?
    end

    should "know its list of configured source files" do
      exp_configured_list = Dassets::SourceList.new(Dassets.config.sources)
      assert_equal exp_configured_list, subject.source_list
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dassets-0.7.0 test/unit/dassets_tests.rb