Skip to content

Commit

Permalink
Fixed failing UnwritableDataDirTest
Browse files Browse the repository at this point in the history
  • Loading branch information
Derek Lindahl committed Jun 24, 2012
1 parent ee21249 commit f717195
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/geminabox.rb
Expand Up @@ -82,8 +82,8 @@ def fixup_bundler_rubygems!


post '/upload' do post '/upload' do
if File.exists? Geminabox.data if File.exists? Geminabox.data
error_response( 500, "Please ensure #{File.expand_path(Geminabox.data)} is writable by the geminabox web server." ) unless File.writable? Geminabox.data
error_response( 500, "Please ensure #{File.expand_path(Geminabox.data)} is a directory." ) unless File.directory? Geminabox.data error_response( 500, "Please ensure #{File.expand_path(Geminabox.data)} is a directory." ) unless File.directory? Geminabox.data
error_response( 500, "Please ensure #{File.expand_path(Geminabox.data)} is writable by the geminabox web server." ) unless File.writable? Geminabox.data
else else
begin begin
FileUtils.mkdir_p(settings.data) FileUtils.mkdir_p(settings.data)
Expand Down
17 changes: 15 additions & 2 deletions test/integration/pushing_gems/data_dir_errors_test.rb
Expand Up @@ -9,10 +9,23 @@ class InvalidDataDirTest < Geminabox::TestCase
end end


class UnwritableDataDirTest < Geminabox::TestCase class UnwritableDataDirTest < Geminabox::TestCase
data "/" def setup
super

FileUtils.mkdir '/tmp/read_only'
FileUtils.chmod 0444, '/tmp/read_only'
end

def teardown
super

FileUtils.rmdir '/tmp/read_only'
end

data "/tmp/read_only"


test "report the error back to the user" do test "report the error back to the user" do
assert_match %r{Please ensure / is writable by the geminabox web server.}, geminabox_push(gem_file(:example)) assert_match %r{Please ensure /tmp/read_only is writable by the geminabox web server.}, geminabox_push(gem_file(:example))
end end
end end


Expand Down

0 comments on commit f717195

Please sign in to comment.