ztk 3.0.4 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ztk/profiler/core.rb +8 -3
- data/lib/ztk/version.rb +1 -1
- data/spec/ztk/ansi_spec.rb +3 -3
- data/spec/ztk/background_spec.rb +22 -22
- data/spec/ztk/base_spec.rb +1 -1
- data/spec/ztk/benchmark_spec.rb +13 -20
- data/spec/ztk/command_spec.rb +48 -61
- data/spec/ztk/config_spec.rb +16 -9
- data/spec/ztk/locator_spec.rb +3 -3
- data/spec/ztk/logger_spec.rb +40 -35
- data/spec/ztk/parallel_spec.rb +20 -20
- data/spec/ztk/profiler_spec.rb +100 -0
- data/spec/ztk/rescue_retry_spec.rb +18 -18
- data/spec/ztk/spinner_spec.rb +3 -3
- data/spec/ztk/ssh_spec.rb +87 -548
- data/spec/ztk/tcp_socket_check_spec.rb +11 -11
- data/spec/ztk/template_spec.rb +14 -13
- data/spec/ztk/ui_spec.rb +9 -9
- data/spec/ztk/version_spec.rb +2 -2
- metadata +4 -2
@@ -27,19 +27,19 @@ describe ZTK::TCPSocketCheck do
|
|
27
27
|
describe "class" do
|
28
28
|
|
29
29
|
it "should be an instance of ZTK::TCPSocketCheck" do
|
30
|
-
subject.
|
30
|
+
expect(subject).to be_an_instance_of ZTK::TCPSocketCheck
|
31
31
|
end
|
32
32
|
|
33
33
|
describe "config" do
|
34
34
|
|
35
35
|
it "should throw an exception if the host is not specified" do
|
36
36
|
subject.config.port = 22
|
37
|
-
|
37
|
+
expect{ subject.ready? }.to raise_error ZTK::TCPSocketCheckError
|
38
38
|
end
|
39
39
|
|
40
40
|
it "should throw an exception if the port is not specified" do
|
41
41
|
subject.config.host = "127.0.0.1"
|
42
|
-
|
42
|
+
expect{ subject.ready? }.to raise_error ZTK::TCPSocketCheckError
|
43
43
|
end
|
44
44
|
|
45
45
|
end
|
@@ -57,7 +57,7 @@ describe ZTK::TCPSocketCheck do
|
|
57
57
|
config.host = "github.com"
|
58
58
|
config.port = 22
|
59
59
|
end
|
60
|
-
subject.ready
|
60
|
+
expect(subject.ready?).to be == true
|
61
61
|
end
|
62
62
|
|
63
63
|
it "should return false on a remote read check to 127.0.0.1:1" do
|
@@ -65,7 +65,7 @@ describe ZTK::TCPSocketCheck do
|
|
65
65
|
config.host = "127.0.0.1"
|
66
66
|
config.port = 1
|
67
67
|
end
|
68
|
-
subject.ready
|
68
|
+
expect(subject.ready?).to be == false
|
69
69
|
end
|
70
70
|
|
71
71
|
end
|
@@ -78,7 +78,7 @@ describe ZTK::TCPSocketCheck do
|
|
78
78
|
config.port = 80
|
79
79
|
config.data = "GET"
|
80
80
|
end
|
81
|
-
subject.ready
|
81
|
+
expect(subject.ready?).to be == true
|
82
82
|
end
|
83
83
|
|
84
84
|
it "should return false on a remote write check to 127.0.0.1:1" do
|
@@ -87,7 +87,7 @@ describe ZTK::TCPSocketCheck do
|
|
87
87
|
config.port = 1
|
88
88
|
config.data = "GET"
|
89
89
|
end
|
90
|
-
subject.ready
|
90
|
+
expect(subject.ready?).to be == false
|
91
91
|
end
|
92
92
|
|
93
93
|
end
|
@@ -104,7 +104,7 @@ describe ZTK::TCPSocketCheck do
|
|
104
104
|
config.port = 1
|
105
105
|
config.wait = WAIT_SMALL
|
106
106
|
end
|
107
|
-
subject.wait.
|
107
|
+
expect(subject.wait).to be == false
|
108
108
|
end
|
109
109
|
|
110
110
|
it "should return true on a read check to github.com:22" do
|
@@ -113,7 +113,7 @@ describe ZTK::TCPSocketCheck do
|
|
113
113
|
config.port = 22
|
114
114
|
config.wait = WAIT_SMALL
|
115
115
|
end
|
116
|
-
subject.wait.
|
116
|
+
expect(subject.wait).to be == true
|
117
117
|
end
|
118
118
|
|
119
119
|
end
|
@@ -127,7 +127,7 @@ describe ZTK::TCPSocketCheck do
|
|
127
127
|
config.data = "GET"
|
128
128
|
config.wait = WAIT_SMALL
|
129
129
|
end
|
130
|
-
subject.wait.
|
130
|
+
expect(subject.wait).to be == false
|
131
131
|
end
|
132
132
|
|
133
133
|
it "should return true on a write check to www.google.com:80" do
|
@@ -137,7 +137,7 @@ describe ZTK::TCPSocketCheck do
|
|
137
137
|
config.data = "GET"
|
138
138
|
config.wait = WAIT_SMALL
|
139
139
|
end
|
140
|
-
subject.wait.
|
140
|
+
expect(subject.wait).to be == true
|
141
141
|
end
|
142
142
|
|
143
143
|
end
|
data/spec/ztk/template_spec.rb
CHANGED
@@ -27,7 +27,7 @@ describe ZTK::Template do
|
|
27
27
|
describe "class" do
|
28
28
|
|
29
29
|
it "should be ZTK::Template" do
|
30
|
-
subject.
|
30
|
+
expect(subject).to be ZTK::Template
|
31
31
|
end
|
32
32
|
|
33
33
|
end
|
@@ -38,28 +38,28 @@ describe ZTK::Template do
|
|
38
38
|
|
39
39
|
it "should render the notice with no options" do
|
40
40
|
result = subject.do_not_edit_notice
|
41
|
-
result.
|
42
|
-
result.
|
43
|
-
result.
|
41
|
+
expect(result).to be =~ /WARNING: AUTOMATICALLY GENERATED FILE; DO NOT EDIT!/
|
42
|
+
expect(result).to be =~ /Generated @/
|
43
|
+
expect(result).to be =~ /#/
|
44
44
|
end
|
45
45
|
|
46
46
|
it "should render the notice with our message inside" do
|
47
47
|
message = "Hello World"
|
48
48
|
result = subject.do_not_edit_notice(:message => message)
|
49
|
-
result.
|
50
|
-
result.
|
51
|
-
result.
|
52
|
-
result.
|
49
|
+
expect(result).to be =~ /WARNING: AUTOMATICALLY GENERATED FILE; DO NOT EDIT!/
|
50
|
+
expect(result).to be =~ /Generated @/
|
51
|
+
expect(result).to be =~ /#/
|
52
|
+
expect(result).to be =~ /#{message}/
|
53
53
|
end
|
54
54
|
|
55
55
|
it "should allow us to change the comment character" do
|
56
56
|
message = "Hello World"
|
57
57
|
char = "ZZ"
|
58
58
|
result = subject.do_not_edit_notice(:message => message, :char => char)
|
59
|
-
result.
|
60
|
-
result.
|
61
|
-
result.
|
62
|
-
result.
|
59
|
+
expect(result).to be =~ /WARNING: AUTOMATICALLY GENERATED FILE; DO NOT EDIT!/
|
60
|
+
expect(result).to be =~ /Generated @/
|
61
|
+
expect(result).to be =~ /#{message}/
|
62
|
+
expect(result).to be =~ /#{char}/
|
63
63
|
end
|
64
64
|
|
65
65
|
end
|
@@ -70,7 +70,8 @@ describe ZTK::Template do
|
|
70
70
|
template_file = File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "test-template.txt.erb"))
|
71
71
|
context = { :test_variable => "Hello World" }
|
72
72
|
output = subject.render(template_file, context)
|
73
|
-
|
73
|
+
|
74
|
+
expect(output).to be == "Hello World"
|
74
75
|
end
|
75
76
|
|
76
77
|
end
|
data/spec/ztk/ui_spec.rb
CHANGED
@@ -27,7 +27,7 @@ describe ZTK::UI do
|
|
27
27
|
describe "class" do
|
28
28
|
|
29
29
|
it "should be ZTK::UI" do
|
30
|
-
subject.
|
30
|
+
expect(subject).to be_an_instance_of ZTK::UI
|
31
31
|
end
|
32
32
|
|
33
33
|
end
|
@@ -35,34 +35,34 @@ describe ZTK::UI do
|
|
35
35
|
describe "behaviour" do
|
36
36
|
|
37
37
|
it "should return a class with accessors for stdout, stderr, stdin and a logger" do
|
38
|
-
subject.stdout.
|
39
|
-
subject.stderr.
|
40
|
-
subject.stdin.
|
41
|
-
subject.logger.
|
38
|
+
expect(subject.stdout).to be == $stdout
|
39
|
+
expect(subject.stderr).to be == $stderr
|
40
|
+
expect(subject.stdin).to be == $stdin
|
41
|
+
expect(subject.logger).to be_an_instance_of ZTK::Logger
|
42
42
|
end
|
43
43
|
|
44
44
|
it "should allow us to set a custom STDOUT" do
|
45
45
|
stdout = StringIO.new
|
46
46
|
ui = ZTK::UI.new(:stdout => stdout)
|
47
|
-
ui.stdout.
|
47
|
+
expect(ui.stdout).to be == stdout
|
48
48
|
end
|
49
49
|
|
50
50
|
it "should allow us to set a custom STDERR" do
|
51
51
|
stderr = StringIO.new
|
52
52
|
ui = ZTK::UI.new(:stderr => stderr)
|
53
|
-
ui.stderr.
|
53
|
+
expect(ui.stderr).to be == stderr
|
54
54
|
end
|
55
55
|
|
56
56
|
it "should allow us to set a custom STDIN" do
|
57
57
|
stdin = StringIO.new
|
58
58
|
ui = ZTK::UI.new(:stdin => stdin)
|
59
|
-
ui.stdin.
|
59
|
+
expect(ui.stdin).to be == stdin
|
60
60
|
end
|
61
61
|
|
62
62
|
it "should allow us to set a custom LOGGER" do
|
63
63
|
logger = StringIO.new
|
64
64
|
ui = ZTK::UI.new(:logger => logger)
|
65
|
-
ui.logger.
|
65
|
+
expect(ui.logger).to be == logger
|
66
66
|
end
|
67
67
|
|
68
68
|
end
|
data/spec/ztk/version_spec.rb
CHANGED
@@ -27,11 +27,11 @@ describe "ZTK::VERSION" do
|
|
27
27
|
describe "object" do
|
28
28
|
|
29
29
|
it "should be defined as a constant" do
|
30
|
-
defined?(ZTK::VERSION).
|
30
|
+
expect(defined?(ZTK::VERSION)).to be == "constant"
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should be a string" do
|
34
|
-
subject
|
34
|
+
expect(subject).to be_kind_of String
|
35
35
|
end
|
36
36
|
|
37
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ztk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zachary Patten
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -356,6 +356,7 @@ files:
|
|
356
356
|
- spec/ztk/locator_spec.rb
|
357
357
|
- spec/ztk/logger_spec.rb
|
358
358
|
- spec/ztk/parallel_spec.rb
|
359
|
+
- spec/ztk/profiler_spec.rb
|
359
360
|
- spec/ztk/pty_spec.rb
|
360
361
|
- spec/ztk/rescue_retry_spec.rb
|
361
362
|
- spec/ztk/spinner_spec.rb
|
@@ -405,6 +406,7 @@ test_files:
|
|
405
406
|
- spec/ztk/locator_spec.rb
|
406
407
|
- spec/ztk/logger_spec.rb
|
407
408
|
- spec/ztk/parallel_spec.rb
|
409
|
+
- spec/ztk/profiler_spec.rb
|
408
410
|
- spec/ztk/pty_spec.rb
|
409
411
|
- spec/ztk/rescue_retry_spec.rb
|
410
412
|
- spec/ztk/spinner_spec.rb
|