Commit 80976a8c1072e40ff0833b8b28c0cc415856aabb
1 parent
1a6ac2de
Exists in
master
and in
29 other branches
rails3: fix themes_controller
Showing
2 changed files
with
2 additions
and
2 deletions
Show diff stats
app/models/theme.rb
@@ -111,7 +111,7 @@ class Theme | @@ -111,7 +111,7 @@ class Theme | ||
111 | 111 | ||
112 | def add_image(filename, data) | 112 | def add_image(filename, data) |
113 | FileUtils.mkdir_p(images_directory) | 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 | f.write(data) | 115 | f.write(data) |
116 | end | 116 | end |
117 | end | 117 | end |
test/functional/themes_controller_test.rb
@@ -216,7 +216,7 @@ class ThemesControllerTest < ActionController::TestCase | @@ -216,7 +216,7 @@ class ThemesControllerTest < ActionController::TestCase | ||
216 | post :add_image, :profile => 'testinguser', :id => 'mytheme', :image => fixture_file_upload('/files/rails.png', 'image/png', :binary) | 216 | post :add_image, :profile => 'testinguser', :id => 'mytheme', :image => fixture_file_upload('/files/rails.png', 'image/png', :binary) |
217 | assert_redirected_to :action => "edit", :id => 'mytheme' | 217 | assert_redirected_to :action => "edit", :id => 'mytheme' |
218 | assert theme.image_files.include?('rails.png') | 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 | end | 220 | end |
221 | 221 | ||
222 | should 'link to "test theme"' do | 222 | should 'link to "test theme"' do |