Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2017-10-03 17:47:56 +0300
committerRémy Coutable <remy@rymai.me>2017-10-03 17:47:56 +0300
commit7b262c435619798cdfebe3760709fc9029032343 (patch)
tree7f908c1297dbda91f49e86bf6385c4211ba4f36f /spec/spec_helper.rb
parent18fee3060c78e032777b5dc6b3d1f60432446ea5 (diff)
Resolve "Precompiled assets with digest strings are ignored in CI"
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r--spec/spec_helper.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index dbf05b7f004..576e4ae1d38 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -169,6 +169,24 @@ RSpec.configure do |config|
end
end
+# add simpler way to match asset paths containing digest strings
+RSpec::Matchers.define :match_asset_path do |expected|
+ match do |actual|
+ path = Regexp.escape(expected)
+ extname = Regexp.escape(File.extname(expected))
+ digest_regex = Regexp.new(path.sub(extname, "(?:-\\h+)?#{extname}") << '$')
+ digest_regex =~ actual
+ end
+
+ failure_message do |actual|
+ "expected that #{actual} would include an asset path for #{expected}"
+ end
+
+ failure_message_when_negated do |actual|
+ "expected that #{actual} would not include an asset path for #{expected}"
+ end
+end
+
FactoryGirl::SyntaxRunner.class_eval do
include RSpec::Mocks::ExampleMethods
end