Sha256: 9855e33b3a720ecdef4bfecaed9b378c79e1d42b6f2ee2937519808598f34c25

Contents?: true

Size: 1.35 KB

Versions: 3

Compression:

Stored size: 1.35 KB

Contents

require File.dirname(__FILE__) + '/test_helper.rb'

class ActionView
  include Depo::ViewHelpers
end

class ActionViewEnv
  attr_accessor :av_values
  def css
    @av_values[:css]
  end
  def app_js
    @av_values[:app_js]
  end
  def webroot
    @av_values[:webroot]
  end
  def djConfig
    @av_values[:djConfig]
  end
  def get_template(v)
    @av_values = v
    tpl_string = IO.readlines(File.dirname(__FILE__) + '/../lib/depo/templates/dojo_src.tpl').to_s
    tpl = ERB.new(tpl_string).result(binding)
  end
end

class ActionPackTest < GeneratorTest
  def test_dojo_helper_development
    assert_equal ActionView.new.dojo(:app => 'app', :env => 'development'), ActionViewEnv.new.get_template({
      :webroot => "/ria/src",
      :app_js => "/ria/src/app/pages/app.js",
      :djConfig => "parseOnLoad:true,isDebug:true",
      :css => "/ria/src/app/themes/tundra/app.css"
    })
    Depo.clear_config!
  end

  def test_dojo_helper_production
    create_if_missing(File.join(Depo.config.builds_path, 'builddir'))
    assert_equal ActionView.new.dojo(:app => 'app', :env => 'production'), ActionViewEnv.new.get_template({
      :webroot => "/ria/builds/builddir",
      :app_js => "/ria/builds/builddir/app/pages/app.js",
      :djConfig => "parseOnLoad:true,isDebug:false",
      :css => "/ria/builds/builddir/app/themes/tundra/app.css"
    })
    Depo.clear_config!
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
depo-0.0.3 test/action_pack_test.rb
depo-0.0.2 test/action_pack_test.rb
depo-0.0.1 test/action_pack_test.rb