Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 6895

Show
Ignore:
Timestamp:
05/29/07 09:58:29 (1 year ago)
Author:
nzkoz
Message:

Fix template compile tests on windows [skaes] closes #8234

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1-2-stable/actionpack/test/template/compiled_templates_test.rb

    r4728 r6895  
    7272 
    7373  def test_compile_time 
    74     `echo '#{@a}' > #{@a}; echo '#{@b}' > #{@b}; ln -s #{@a} #{@s}` 
     74    File.open(@a, "w"){|f| f.puts @a} 
     75    File.open(@b, "w"){|f| f.puts @b} 
     76 
     77    # windows doesn't support symlinks (even under cygwin) 
     78    windows = (RUBY_PLATFORM =~ /win32/) 
     79    `ln -s #{@a} #{@s}` unless windows 
    7580 
    7681    v = ActionView::Base.new 
     
    8085    sleep 1 
    8186    t = Time.now 
     87    sleep 1 
     88 
    8289    v.compile_and_render_template(:rhtml, '', @a) 
    8390    v.compile_and_render_template(:rhtml, '', @b) 
    84     v.compile_and_render_template(:rhtml, '', @s) 
     91    v.compile_and_render_template(:rhtml, '', @s) unless windows 
     92 
    8593    a_n = v.method_names[@a] 
    8694    b_n = v.method_names[@b] 
    87     s_n = v.method_names[@s] 
     95    s_n = v.method_names[@s]  unless windows 
     96    ct_a = v.compile_time[a_n] 
     97    ct_b = v.compile_time[b_n] 
     98    ct_s = v.compile_time[s_n] unless windows 
    8899    # all of the files have changed since last compile 
    89100    assert v.compile_time[a_n] > t 
    90101    assert v.compile_time[b_n] > t 
    91     assert v.compile_time[s_n] > t 
     102    assert v.compile_time[s_n] > t unless windows 
    92103 
    93104    sleep 1 
    94     t = Time.now 
    95105    v.compile_and_render_template(:rhtml, '', @a) 
    96106    v.compile_and_render_template(:rhtml, '', @b) 
    97     v.compile_and_render_template(:rhtml, '', @s) 
     107    v.compile_and_render_template(:rhtml, '', @s) unless windows 
    98108    # none of the files have changed since last compile 
    99     assert v.compile_time[a_n] < t 
    100     assert v.compile_time[b_n] < t 
    101     assert v.compile_time[s_n] < t 
     109    # so they should not have been recmpiled 
     110    assert_equal ct_a, v.compile_time[a_n] 
     111    assert_equal ct_b, v.compile_time[b_n] 
     112    assert_equal ct_s, v.compile_time[s_n] unless windows 
    102113 
    103     `rm #{@s}; ln -s #{@b} #{@s}` 
     114    `rm #{@s}; ln -s #{@b} #{@s}` unless windows 
    104115    v.compile_and_render_template(:rhtml, '', @a) 
    105116    v.compile_and_render_template(:rhtml, '', @b) 
    106     v.compile_and_render_template(:rhtml, '', @s) 
     117    v.compile_and_render_template(:rhtml, '', @s) unless windows 
    107118    # the symlink has changed since last compile 
    108     assert v.compile_time[a_n] < t 
    109     assert v.compile_time[b_n] < t 
    110     assert v.compile_time[s_n] > t 
     119    assert_equal ct_a, v.compile_time[a_n] 
     120    assert_equal ct_b, v.compile_time[b_n] 
     121    assert v.compile_time[s_n] > t unless windows 
    111122 
    112123    sleep 1 
    113     `touch #{@b}` 
     124    FileUtils.touch @b 
    114125    t = Time.now 
     126    sleep 1 
    115127    v.compile_and_render_template(:rhtml, '', @a) 
    116128    v.compile_and_render_template(:rhtml, '', @b) 
    117     v.compile_and_render_template(:rhtml, '', @s) 
     129    v.compile_and_render_template(:rhtml, '', @s) unless windows 
    118130    # the file at the end of the symlink has changed since last compile 
    119131    # both the symlink and the file at the end of it should be recompiled 
    120132    assert v.compile_time[a_n] < t 
    121133    assert v.compile_time[b_n] > t 
    122     assert v.compile_time[s_n] > t 
     134    assert v.compile_time[s_n] > t unless windows 
    123135  end 
    124136end