Sha256: 04c03d17b3f3ebb60ae3ee3786827577bf1917acae070d8f5741b782c4e28ef6

Contents?: true

Size: 1.65 KB

Versions: 17

Compression:

Stored size: 1.65 KB

Contents

require "buildtasks/manifest/spec_helper"

describe "manifest:prepare_build_tasks:json" do

  include SC::SpecHelpers
  include SC::ManifestSpecHelpers

  before do
    std_before
  end

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

  it "should run manifest:prepare_build_tasks:setup as prereq" do
    should_run('manifest:prepare_build_tasks:setup') { run_task }
  end


  it "assigns a json build task to each json file" do
    run_task
    entries = @manifest.entries.select { |e| e.entry_type == :json }
    entries.each do |entry|
      e[:build_task].should == "build:json"
    end
  end

  describe "supports require() and sc_require() statements" do

    it "adds a entry.required property to entrys with empty array of no requires are specified in file"  do
      run_task
      entry = entry_for('source/no_require.js')
      entry.required.should == []
    end

    it "searches files for require() & sc_requires() statements and adds them to entry.required array -- (also should ignore any ext)" do
      run_task
      entry = entry_for('source/has_require.js')
      entry.required.sort.should == ['demo2', 'no_require']
    end

  end

  describe "supports sc_resource() statement" do
    it "sets entry.resource = 'javascript' if no sc_resource statement is found in files" do
      run_task
      entry = entry_for('source/no_require.js')
      entry.resource.should == 'javascript'
    end

    it "searches files for sc_resource() statement and stores last value in entry.resource property" do
      run_task
      entry  =entry_for 'source/sc_resource.js'
      entry.resource.should == 'bar'
    end
  end



end

Version data entries

17 entries across 17 versions & 1 rubygems

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