Commit 3d63f6b0e7ad5078116b8b2912ec9aa6be826193

Authored by Rodrigo Souto
1 parent cca9b1ed

rails3: fix theme tests

Showing 1 changed file with 6 additions and 6 deletions   Show diff stats
test/unit/theme_test.rb
... ... @@ -13,7 +13,7 @@ class ThemeTest < ActiveSupport::TestCase
13 13 end
14 14  
15 15 should 'list system themes' do
16   - Dir.expects(:glob).with(Rails.root.join('public', 'designs', 'themes', '*')).returns(
  16 + Dir.expects(:glob).with(Rails.root.join('public', 'designs', 'themes', '*').to_s).returns(
17 17 [
18 18 Rails.root.join('public', 'designs', 'themes', 'themeone'),
19 19 Rails.root.join('public', 'designs', 'themes', 'themetwo'),
... ... @@ -55,14 +55,14 @@ class ThemeTest < ActiveSupport::TestCase
55 55 should 'be able to add new CSS file to theme' do
56 56 t = Theme.create('mytheme')
57 57 t.add_css('common.css')
58   - assert_equal '', File.read(TMP_THEMES_DIR + '/mytheme/stylesheets/common.css')
  58 + assert_equal '', File.read(TMP_THEMES_DIR.join('mytheme', 'stylesheets', 'common.css'))
59 59 end
60 60  
61 61 should 'be able to update CSS file' do
62 62 t = Theme.create('mytheme')
63 63 t.add_css('common.css')
64 64 t.update_css('common.css', '/* only a comment */')
65   - assert_equal '/* only a comment */', File.read(TMP_THEMES_DIR + '/mytheme/stylesheets/common.css')
  65 + assert_equal '/* only a comment */', File.read(TMP_THEMES_DIR.join('mytheme', 'stylesheets', 'common.css'))
66 66 end
67 67  
68 68 should 'be able to get content of CSS file' do
... ... @@ -144,7 +144,7 @@ class ThemeTest < ActiveSupport::TestCase
144 144 theme = Theme.create('mytheme')
145 145 theme.add_image('test.png', 'FAKE IMAGE DATA')
146 146  
147   - assert_equal 'FAKE IMAGE DATA', File.read(TMP_THEMES_DIR + '/mytheme/images/test.png')
  147 + assert_equal 'FAKE IMAGE DATA', File.read(TMP_THEMES_DIR.join('mytheme', 'images', 'test.png'))
148 148 end
149 149  
150 150 should 'list images' do
... ... @@ -173,8 +173,8 @@ class ThemeTest < ActiveSupport::TestCase
173 173 should 'not list non theme files or dirs inside themes dir' do
174 174 Theme.stubs(:system_themes_dir).returns(TMP_THEMES_DIR)
175 175 Dir.mkdir(TMP_THEMES_DIR)
176   - Dir.mkdir(TMP_THEMES_DIR+'/empty-dir')
177   - File.new(TMP_THEMES_DIR+'/my-logo.png', File::CREAT)
  176 + Dir.mkdir(TMP_THEMES_DIR.join('empty-dir'))
  177 + File.new(TMP_THEMES_DIR.join('my-logo.png'), File::CREAT)
178 178 assert Theme.approved_themes(Environment.default).empty?
179 179 end
180 180  
... ...