Sha256: 47ea2ff591e4aa52aa3a9782d59c53b1c3ba5a5b07c107ff5d619369fc0fbe31

Contents?: true

Size: 1.91 KB

Versions: 43

Compression:

Stored size: 1.91 KB

Contents

require "buildtasks/manifest/spec_helper"

describe "manifest:prepare_build_tasks:minify" do

  include SC::SpecHelpers
  include SC::ManifestSpecHelpers

  before do
    std_before
  end

  def run_task
    @manifest.prepare!
    super('manifest:prepare_build_tasks:minify')
  end

  it "should run setup, javascript, css, and combine as prereq" do
    %w(setup javascript css sass less combine).each do |task_name|
      should_run("manifest:prepare_build_tasks:#{task_name}") { run_task }
    end
  end

  describe "minify javascript tasks" do

    def should_have_minify_javascript_tasks
      entries = @manifest.entries.select { |e| e.entry_type == :javascript }
      entries.each do |entry|
        entry.should be_minified
        entry.should be_transform
        entry.source_entry.entry_type.should == :javascript
      end
    end

    def should_not_have_minify_javascript_tasks
      entries = @manifest.entries.select { |e| e.entry_type == :javascript }
      entries.each do |entry|
        entry.should_not be_minified
      end
    end

    it "adds task when CONFIG.minify_javascript == true" do
      @target.config.minify_javascript = true
      run_task
      should_have_minify_javascript_tasks
    end

    it "adds task when CONFIG.minify == true" do
      @target.config.minify = true
      @target.config.minify_javascript = nil # assume not defined
      run_task
      should_have_minify_javascript_tasks
    end

    it "does not add task when CONFIG.minify == true but CONFIG.minify_javascript == false" do
      @target.config.minify = true
      @target.config.minify_javascript = false
      run_task
      should_not_have_minify_javascript_tasks
    end

    it "does not add task when CONFIG.minify == false and CONFIG.minify_javascript is not defined" do
      @target.config.minify = false
      @target.config.minify_javascript = nil
      run_task
      should_not_have_minify_javascript_tasks
    end

  end

end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
sproutcore-1.11.0 spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb
sproutcore-1.11.0.rc3 spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb
sproutcore-1.11.0.rc2 spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb
sproutcore-1.11.0.rc1 spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb
sproutcore-1.10.3.1 spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb
sproutcore-1.10.2 spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb
sproutcore-1.10.1 spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb
sproutcore-1.10.0 spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb
sproutcore-1.10.0.rc.3 spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb
sproutcore-1.10.0.rc.2 spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb
sproutcore-1.10.0.rc.1 spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb
sproutcore-1.9.2 spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb
sproutcore-1.9.1 spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb
sproutcore-1.9.0 spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb
sproutcore-1.8.2.1 spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb
sproutcore-1.8.1 spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb
sproutcore-1.8.0 spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb
sproutcore-1.7.1.beta-java spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb
sproutcore-1.7.1.beta spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb
sproutcore-1.6.0.1-java spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb