hub 1.11.0 → 1.11.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of hub might be problematic. Click here for more details.

@@ -1,57 +0,0 @@
1
- require 'helper'
2
- require 'hub/standalone'
3
- require 'fileutils'
4
- require 'stringio'
5
-
6
- class StandaloneTest < Minitest::Test
7
- include FileUtils
8
-
9
- def setup
10
- rm "hub" if File.exists? 'hub'
11
- rm_rf "/tmp/_hub_private" if File.exists? '/tmp/_hub_private'
12
- mkdir "/tmp/_hub_private"
13
- chmod 0400, "/tmp/_hub_private"
14
- end
15
-
16
- def teardown
17
- rm "hub" if File.exists? 'hub'
18
- rm_rf "/tmp/_hub_private" if File.exists? "/tmp/_hub_private"
19
- end
20
-
21
- def test_standalone
22
- io = StringIO.new
23
- Hub::Standalone.build io
24
- standalone = io.string
25
-
26
- assert_includes "This file is generated code", standalone
27
- assert_includes "Runner", standalone
28
- assert_includes "Args", standalone
29
- assert_includes "Commands", standalone
30
- assert_includes ".execute(*ARGV)", standalone
31
- assert_not_includes "module Standalone", standalone
32
-
33
- standalone =~ /__END__\s*(.+)/m
34
- assert_equal File.read('man/hub.1'), $1
35
- end
36
-
37
- def test_standalone_save
38
- Hub::Standalone.save("hub")
39
- output = `RUBYOPT= RUBYLIB= ./hub version 2>&1`
40
- assert_equal <<-OUT, output
41
- git version 1.7.0.4
42
- hub version #{Hub::VERSION}
43
- OUT
44
- end
45
-
46
- def test_standalone_save_permission_denied
47
- assert_raises Errno::EACCES do
48
- Hub::Standalone.save("hub", "/tmp/_hub_private")
49
- end
50
- end
51
-
52
- def test_standalone_save_doesnt_exist
53
- assert_raises Errno::ENOENT do
54
- Hub::Standalone.save("hub", "/tmp/something/not/real")
55
- end
56
- end
57
- end