Permalink
Browse files

Merge pull request #69 from dlindahl/master

Fixed failing UnwritableDataDir test
  • Loading branch information...
2 parents f931829 + f717195 commit 59d573d7a0c79ce05572b9cd52f38249e09242a2 @tomlea committed Jun 25, 2012
Showing with 16 additions and 3 deletions.
  1. +1 −1 lib/geminabox.rb
  2. +15 −2 test/integration/pushing_gems/data_dir_errors_test.rb
View
2 lib/geminabox.rb
@@ -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)
View
17 test/integration/pushing_gems/data_dir_errors_test.rb
@@ -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

0 comments on commit 59d573d

Please sign in to comment.