diff --git a/lib/asset_checker.rb b/lib/asset_checker.rb index 74e7cb78b48..3893a4151cb 100644 --- a/lib/asset_checker.rb +++ b/lib/asset_checker.rb @@ -9,8 +9,8 @@ def self.check_files(argv) def self.file_has_missing?(file) data = File.open(file).read - missing_translations = find_missing(data, /\Wt\s?\(['"]([^'^"]*)['"]\)/, @translation_strings) - missing_assets = find_missing(data, /\WassetPath=["'](.*)['"]/, @asset_strings) + missing_translations = find_missing(data, /\Wt\s?\(['"]([^'"]*?)['"]\)/, @translation_strings) + missing_assets = find_missing(data, /\WassetPath=["'](.*?)['"]/, @asset_strings) has_missing = (missing_translations.any? || missing_assets.any?) if has_missing warn file diff --git a/spec/lib/asset_checker_spec.rb b/spec/lib/asset_checker_spec.rb index 8c9b2f5647f..e819e440cdf 100644 --- a/spec/lib/asset_checker_spec.rb +++ b/spec/lib/asset_checker_spec.rb @@ -25,6 +25,7 @@ def get_js_with_strings(asset, translation)

{t('#{translation}')}

+ \"\" ); } @@ -73,7 +74,7 @@ def get_js_with_strings(asset, translation) translation_strings) expect(AssetChecker).to receive(:warn).with(tempfile.path) expect(AssetChecker).to receive(:warn).with('Missing translation, not-found') - expect(AssetChecker).to receive(:warn).with('Missing asset, wont_find.svg') + expect(AssetChecker).to receive(:warn).twice.with('Missing asset, wont_find.svg') expect(AssetChecker.check_files([tempfile.path])).to eq(true) end end