Sha256: 96f270ca6021f49a5482584438646124e2fdab0e26f5b20d3778adf2c064b20b

Contents?: true

Size: 1.18 KB

Versions: 7

Compression:

Stored size: 1.18 KB

Contents

require_relative "spec_helper_initializer"

describe "EngineRakeTasks" do
  before :context do
    remove_webpack_binstubs
  end

  after :context do
    remove_webpack_binstubs
  end

  it "mounts app:webpacker task successfully" do
    output = Dir.chdir(mounted_app_path) { `rake -T` }
    expect(output).to match /app:webpacker.+DEPRECATED/
    expect(output).to match /app:webpacker:binstubs.+DEPRECATED/
  end

  it "binstubs adds only expected files to bin directory" do
    Dir.chdir(mounted_app_path) { `bundle exec rake app:webpacker:binstubs` }
    expected_binstub_paths.each { |path| expect(File.exist?(path)).to be true }
  end

  private
    def mounted_app_path
      File.expand_path("../mounted_app", __dir__)
    end

    def current_files_in_bin
      Dir.glob("#{mounted_app_path}/test/dummy/bin/*")
    end

    def expected_binstub_paths
      gem_path = File.expand_path("../..", __dir__)
      Dir.chdir("#{gem_path}/lib/install/bin") do
        Dir.glob("*").map { |file| "#{mounted_app_path}/test/dummy/bin/#{file}" }
      end
    end

    def remove_webpack_binstubs
      expected_binstub_paths.each do |path|
        File.delete(path) if File.exist?(path)
      end
    end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
shakapacker-7.0.3 spec/backward_compatibility_specs/engine_rake_tasks_spec.rb
shakapacker-7.0.2 spec/backward_compatibility_specs/engine_rake_tasks_spec.rb
shakapacker-7.0.1 spec/backward_compatibility_specs/engine_rake_tasks_spec.rb
shakapacker-7.0.0 spec/backward_compatibility_specs/engine_rake_tasks_spec.rb
shakapacker-7.0.0.rc.2 spec/backward_compatibility_specs/engine_rake_tasks_spec.rb
shakapacker-7.0.0.rc.1 spec/backward_compatibility_specs/engine_rake_tasks_spec.rb
shakapacker-7.0.0.rc.0 spec/backward_compatibility_specs/engine_rake_tasks_spec_bc.rb