test/unit/source_file_tests.rb in dassets-0.15.0 vs test/unit/source_file_tests.rb in dassets-0.15.1

- old
+ new

@@ -1,16 +1,18 @@ +# frozen_string_literal: true + require "assert" require "dassets/source_file" require "dassets/asset_file" require "dassets/cache" require "dassets/source_proxy" class Dassets::SourceFile class UnitTests < Assert::Context desc "Dassets::SourceFile" - subject { Dassets::SourceFile.new(@file_path) } + subject{ Dassets::SourceFile.new(@file_path) } setup do @file_path = TEST_SUPPORT_PATH.join("app/assets/file1.txt").to_s end @@ -104,26 +106,30 @@ assert_that(null_src.file_path).equals("") assert_that(null_src.exists?).equals(false) assert_that(null_src.compiled).is_nil assert_that(null_src.mtime).is_nil - assert_that(null_src.response_headers).equals(Hash.new) + assert_that(null_src.response_headers).equals({}) end - should "pass options to a null src when finding by an unknown digest path" do + should "pass options to a null src when finding by an unknown digest "\ + "path" do null_src = Dassets::NullSourceFile.new("not/found/digest/path") null_src_new_called_with = [] Assert.stub(Dassets::NullSourceFile, :new) do |*args| null_src_new_called_with = args null_src end options = { - content_cache: Dassets::NoCache.new, + content_cache: Dassets::NoCache.new, fingerprint_cache: Dassets::NoCache.new, } - Dassets::SourceFile.find_by_digest_path("not/found/digest/path", **options) + Dassets::SourceFile.find_by_digest_path( + "not/found/digest/path", + **options, + ) exp = ["not/found/digest/path", options] assert_that(null_src_new_called_with).equals(exp) end @@ -143,10 +149,10 @@ src_proxy_new_called_with = args src_proxy end options = { - content_cache: Dassets::NoCache.new, + content_cache: Dassets::NoCache.new, fingerprint_cache: Dassets::NoCache.new, } Dassets::NullSourceFile.new("file3.txt", **options) exp = ["file3.txt", options]