Skip to content

Commit

Permalink
Merge pull request geminabox#69 from dlindahl/master
Browse files Browse the repository at this point in the history
Fixed failing UnwritableDataDir test
  • Loading branch information
tomlea committed Jun 25, 2012
2 parents f931829 + f717195 commit 59d573d
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 @@ -83,8 +83,8 @@ def fixup_bundler_rubygems!

post '/upload' do
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 writable by the geminabox web server." ) unless File.writable? Geminabox.data
else
begin
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

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
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

Expand Down

0 comments on commit 59d573d

Please sign in to comment.