Sha256: 787a2fff28a7e0d2d3389649b80e38b4f2bd32776ec3246310b9b30cf7f48d8b

Contents?: true

Size: 1.43 KB

Versions: 10

Compression:

Stored size: 1.43 KB

Contents

require 'test_helper'

class RefactorTest < Zena::View::TestCase
  tests Zena::Use::Refactor::ViewMethods # fquote

  def _(k)
    k
  end

  def zen_path(obj, opts)
    "/#{opts[:lang]}/#{obj.zip}.html"
  end

  def test_render_to_string
    assert_match 'stupid test 25',  render_to_string(:inline=>'stupid <%= "test" %> <%= 5*5 %>')
  end

  def test_fsize
    assert_equal '29 Kb', fsize(29279)
    assert_equal '502 Kb', fsize(513877)
    assert_equal '5.2 Mb', fsize(5480809)
    assert_equal '450.1 Mb', fsize(471990272)
    assert_equal '2.35 Gb', fsize(2518908928)
  end

  def test_rnd
    assert ((Time.now.to_i-1 <= rnd) && (rnd <= Time.now.to_i+2))
  end

  def test_change_lang
    assert_equal ({:overwrite_params=>{:prefix=>'io'}}), change_lang('io')
    login(:ant)
    assert_equal ({:overwrite_params=>{:lang=>'io'}}), change_lang('io')
  end

  def test_traductions
    visitor.lang = 'en'
    # we must initialize an url for url_rewriting in 'traductions'
    @controller.instance_eval { @url = ActionController::UrlRewriter.new( @request, {:controller=>'nodes', :action=>'index'} ) }
    @node = secure!(Node) { Node.find(nodes_id(:status)) } # en,fr
    trad = traductions
    assert_equal 2, trad.size
    assert_match %r{class='current'.*href="/en}, trad[0]
    assert_no_match %r{class='current'}, trad[1]
    @node = secure!(Node) { Node.find(nodes_id(:cleanWater)) } #  en
    trad = traductions
    assert_equal 1, trad.size
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
zena-0.16.9 test/unit/zena/use/refactor_test.rb
zena-0.16.8 test/unit/zena/use/refactor_test.rb
zena-0.16.7 test/unit/zena/use/refactor_test.rb
zena-0.16.6 test/unit/zena/use/refactor_test.rb
zena-0.16.5 test/unit/zena/use/refactor_test.rb
zena-0.16.4 test/unit/zena/use/refactor_test.rb
zena-0.16.3 test/unit/zena/use/refactor_test.rb
zena-0.16.2 test/unit/zena/use/refactor_test.rb
zena-0.16.1 test/unit/zena/use/refactor_test.rb
zena-0.16.0 test/unit/zena/use/refactor_test.rb