diff options
author | Mike Greiling <mike@pixelcog.com> | 2017-10-03 14:47:56 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-10-03 14:47:56 +0000 |
commit | 7b262c435619798cdfebe3760709fc9029032343 (patch) | |
tree | 7f908c1297dbda91f49e86bf6385c4211ba4f36f /spec/spec_helper.rb | |
parent | 18fee3060c78e032777b5dc6b3d1f60432446ea5 (diff) | |
download | gitlab-ce-7b262c435619798cdfebe3760709fc9029032343.tar.gz |
Resolve "Precompiled assets with digest strings are ignored in CI"
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r-- | spec/spec_helper.rb | 18 |
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 |