Commit 80976a8c1072e40ff0833b8b28c0cc415856aabb

Authored by Victor Costa
1 parent 1a6ac2de

rails3: fix themes_controller

app/models/theme.rb
... ... @@ -111,7 +111,7 @@ class Theme
111 111  
112 112 def add_image(filename, data)
113 113 FileUtils.mkdir_p(images_directory)
114   - File.open(image_path(filename), 'w') do |f|
  114 + File.open(image_path(filename), 'wb') do |f|
115 115 f.write(data)
116 116 end
117 117 end
... ...
test/functional/themes_controller_test.rb
... ... @@ -216,7 +216,7 @@ class ThemesControllerTest < ActionController::TestCase
216 216 post :add_image, :profile => 'testinguser', :id => 'mytheme', :image => fixture_file_upload('/files/rails.png', 'image/png', :binary)
217 217 assert_redirected_to :action => "edit", :id => 'mytheme'
218 218 assert theme.image_files.include?('rails.png')
219   - assert(system('diff', Rails.root.join('test', 'fixtures', 'files','rails.png'), TMP_THEMES_DIR + '/mytheme/images/rails.png'), 'should put the correct uploaded file in the right place')
  219 + assert(system('diff', Rails.root.join('test', 'fixtures', 'files','rails.png').to_s, TMP_THEMES_DIR.join('mytheme/images/rails.png').to_s), 'should put the correct uploaded file in the right place')
220 220 end
221 221  
222 222 should 'link to "test theme"' do
... ...