ztk 3.0.4 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.should be_an_instance_of ZTK::TCPSocketCheck
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
- lambda{ subject.ready? }.should raise_error ZTK::TCPSocketCheckError, "You must supply a host!"
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
- lambda{ subject.ready? }.should raise_error ZTK::TCPSocketCheckError, "You must supply a port!"
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?.should == true
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?.should == false
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?.should == true
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?.should == false
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.should == false
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.should == true
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.should == false
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.should == true
140
+ expect(subject.wait).to be == true
141
141
  end
142
142
 
143
143
  end
@@ -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.should be ZTK::Template
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.should =~ /WARNING: AUTOMATICALLY GENERATED FILE; DO NOT EDIT!/
42
- result.should =~ /Generated @/
43
- result.should =~ /#/
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.should =~ /WARNING: AUTOMATICALLY GENERATED FILE; DO NOT EDIT!/
50
- result.should =~ /Generated @/
51
- result.should =~ /#/
52
- result.should =~ /#{message}/
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.should =~ /WARNING: AUTOMATICALLY GENERATED FILE; DO NOT EDIT!/
60
- result.should =~ /Generated @/
61
- result.should =~ /#{message}/
62
- result.should =~ /#{char}/
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
- output.should == "Hello World"
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.should be_an_instance_of ZTK::UI
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.should == $stdout
39
- subject.stderr.should == $stderr
40
- subject.stdin.should == $stdin
41
- subject.logger.should be_an_instance_of ZTK::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.should == 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.should == 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.should == 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.should == logger
65
+ expect(ui.logger).to be == logger
66
66
  end
67
67
 
68
68
  end
@@ -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).should == "constant"
30
+ expect(defined?(ZTK::VERSION)).to be == "constant"
31
31
  end
32
32
 
33
33
  it "should be a string" do
34
- subject.is_a?(String).should == true
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
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-06 00:00:00.000000000 Z
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