Sha256: bd20035138a529f22696b78db97aa513652582a4705bbac03581b553cf22180e

Contents?: true

Size: 831 Bytes

Versions: 10

Compression:

Stored size: 831 Bytes

Contents

require 'test_helper'
require 'fileutils'
require 'find'
require 'shellwords'

class SprocketsRailsTest < Minitest::Test

  def test_sprockets_digest_asset_refs
    root     = 'test/dummy_app'
    command  = "bundle exec rake assets:precompile GEMFILE=#{GEM_PATH}/Gemfile RAILS_ENV=production"
    compiled = Dir.chdir root do
      silence_stderr_if !ENV['VERBOSE'] do
        system(command)
      end
    end
    assert compiled, 'Could not precompile assets'
    Dir.glob(File.join(root, 'public', 'assets', 'app*.{css,js}')) do |path|
      File.open(path, 'r') do |f|
        f.read.scan /url\("?[^"]+\.(?:jpg|png|eot|woff2?|ttf|svg)[^"]*"?\)/ do |m|
          assert_match /-[0-9a-f]{12,}\./, m
        end
      end
    end
  ensure
    FileUtils.rm_rf %W(#{root}/public/assets/ #{root}/tmp/cache/), secure: true
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
envvy-1.0.10 test/compilation/js_test.rb
envvy-1.0.9 test/compilation/js_test.rb
envvy-1.0.8 test/compilation/js_test.rb
envvy-1.0.7 test/compilation/js_test.rb
envvy-1.0.6 test/compilation/js_test.rb
envvy-1.0.5 test/compilation/js_test.rb
envvy-1.0.4 test/compilation/js_test.rb
envvy-1.0.3 test/compilation/js_test.rb
envvy-1.0.2 test/compilation/js_test.rb
envvy-1.0.1 test/compilation/js_test.rb