ronin-support 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +11 -0
  3. data/.github/workflows/ruby.yml +28 -0
  4. data/.ruby-version +1 -0
  5. data/.yardopts +1 -1
  6. data/ChangeLog.md +28 -0
  7. data/Gemfile +6 -7
  8. data/README.md +53 -32
  9. data/Rakefile +1 -2
  10. data/gemspec.yml +16 -7
  11. data/lib/ronin/binary.rb +5 -5
  12. data/lib/ronin/binary/hexdump.rb +5 -5
  13. data/lib/ronin/binary/hexdump/parser.rb +5 -5
  14. data/lib/ronin/binary/struct.rb +5 -5
  15. data/lib/ronin/binary/template.rb +7 -7
  16. data/lib/ronin/extensions.rb +5 -5
  17. data/lib/ronin/extensions/enumerable.rb +5 -5
  18. data/lib/ronin/extensions/file.rb +37 -31
  19. data/lib/ronin/extensions/ip_addr.rb +6 -7
  20. data/lib/ronin/extensions/kernel.rb +5 -5
  21. data/lib/ronin/extensions/meta.rb +5 -5
  22. data/lib/ronin/extensions/regexp.rb +5 -5
  23. data/lib/ronin/extensions/resolv.rb +5 -5
  24. data/lib/ronin/extensions/string.rb +5 -5
  25. data/lib/ronin/formatting.rb +5 -5
  26. data/lib/ronin/formatting/binary.rb +5 -5
  27. data/lib/ronin/formatting/digest.rb +5 -5
  28. data/lib/ronin/formatting/extensions.rb +5 -5
  29. data/lib/ronin/formatting/extensions/binary.rb +5 -5
  30. data/lib/ronin/formatting/extensions/binary/array.rb +6 -6
  31. data/lib/ronin/formatting/extensions/binary/base64.rb +5 -5
  32. data/lib/ronin/formatting/extensions/binary/file.rb +5 -5
  33. data/lib/ronin/formatting/extensions/binary/float.rb +6 -6
  34. data/lib/ronin/formatting/extensions/binary/integer.rb +6 -6
  35. data/lib/ronin/formatting/extensions/binary/string.rb +6 -6
  36. data/lib/ronin/formatting/extensions/digest.rb +5 -5
  37. data/lib/ronin/formatting/extensions/digest/file.rb +5 -5
  38. data/lib/ronin/formatting/extensions/digest/string.rb +5 -5
  39. data/lib/ronin/formatting/extensions/html.rb +5 -5
  40. data/lib/ronin/formatting/extensions/html/integer.rb +5 -5
  41. data/lib/ronin/formatting/extensions/html/string.rb +7 -7
  42. data/lib/ronin/formatting/extensions/http.rb +5 -5
  43. data/lib/ronin/formatting/extensions/http/integer.rb +6 -6
  44. data/lib/ronin/formatting/extensions/http/string.rb +7 -7
  45. data/lib/ronin/formatting/extensions/sql.rb +5 -5
  46. data/lib/ronin/formatting/extensions/sql/string.rb +15 -13
  47. data/lib/ronin/formatting/extensions/text.rb +5 -5
  48. data/lib/ronin/formatting/extensions/text/array.rb +5 -5
  49. data/lib/ronin/formatting/extensions/text/string.rb +5 -5
  50. data/lib/ronin/formatting/html.rb +5 -5
  51. data/lib/ronin/formatting/http.rb +5 -5
  52. data/lib/ronin/formatting/sql.rb +5 -5
  53. data/lib/ronin/formatting/text.rb +5 -5
  54. data/lib/ronin/fuzzing.rb +5 -5
  55. data/lib/ronin/fuzzing/extensions.rb +5 -5
  56. data/lib/ronin/fuzzing/extensions/string.rb +5 -5
  57. data/lib/ronin/fuzzing/fuzzer.rb +5 -5
  58. data/lib/ronin/fuzzing/fuzzing.rb +7 -7
  59. data/lib/ronin/fuzzing/mutator.rb +5 -5
  60. data/lib/ronin/fuzzing/repeater.rb +5 -5
  61. data/lib/ronin/fuzzing/template.rb +5 -5
  62. data/lib/ronin/mixin.rb +2 -2
  63. data/lib/ronin/network.rb +5 -5
  64. data/lib/ronin/network/dns.rb +5 -5
  65. data/lib/ronin/network/esmtp.rb +5 -5
  66. data/lib/ronin/network/extensions.rb +5 -5
  67. data/lib/ronin/network/extensions/dns.rb +5 -5
  68. data/lib/ronin/network/extensions/dns/net.rb +5 -5
  69. data/lib/ronin/network/extensions/esmtp.rb +5 -5
  70. data/lib/ronin/network/extensions/esmtp/net.rb +5 -5
  71. data/lib/ronin/network/extensions/http.rb +5 -5
  72. data/lib/ronin/network/extensions/http/net.rb +5 -5
  73. data/lib/ronin/network/extensions/http/uri/http.rb +5 -5
  74. data/lib/ronin/network/extensions/imap.rb +5 -5
  75. data/lib/ronin/network/extensions/imap/net.rb +5 -5
  76. data/lib/ronin/network/extensions/pop3.rb +5 -5
  77. data/lib/ronin/network/extensions/pop3/net.rb +5 -5
  78. data/lib/ronin/network/extensions/smtp.rb +5 -5
  79. data/lib/ronin/network/extensions/smtp/net.rb +5 -5
  80. data/lib/ronin/network/extensions/ssl.rb +5 -5
  81. data/lib/ronin/network/extensions/ssl/net.rb +5 -5
  82. data/lib/ronin/network/extensions/tcp.rb +5 -5
  83. data/lib/ronin/network/extensions/tcp/net.rb +5 -5
  84. data/lib/ronin/network/extensions/telnet.rb +5 -5
  85. data/lib/ronin/network/extensions/telnet/net.rb +5 -5
  86. data/lib/ronin/network/extensions/udp.rb +5 -5
  87. data/lib/ronin/network/extensions/udp/net.rb +5 -5
  88. data/lib/ronin/network/ftp.rb +5 -5
  89. data/lib/ronin/network/http.rb +5 -5
  90. data/lib/ronin/network/http/exceptions.rb +5 -5
  91. data/lib/ronin/network/http/exceptions/unknown_request.rb +5 -5
  92. data/lib/ronin/network/http/http.rb +52 -57
  93. data/lib/ronin/network/http/proxy.rb +5 -5
  94. data/lib/ronin/network/imap.rb +5 -5
  95. data/lib/ronin/network/mixins.rb +5 -5
  96. data/lib/ronin/network/mixins/dns.rb +5 -5
  97. data/lib/ronin/network/mixins/esmtp.rb +5 -5
  98. data/lib/ronin/network/mixins/ftp.rb +5 -5
  99. data/lib/ronin/network/mixins/http.rb +7 -7
  100. data/lib/ronin/network/mixins/imap.rb +5 -5
  101. data/lib/ronin/network/mixins/mixin.rb +5 -5
  102. data/lib/ronin/network/mixins/pop3.rb +5 -5
  103. data/lib/ronin/network/mixins/smtp.rb +5 -5
  104. data/lib/ronin/network/mixins/ssl.rb +5 -5
  105. data/lib/ronin/network/mixins/tcp.rb +5 -5
  106. data/lib/ronin/network/mixins/telnet.rb +5 -5
  107. data/lib/ronin/network/mixins/udp.rb +5 -5
  108. data/lib/ronin/network/mixins/unix.rb +5 -5
  109. data/lib/ronin/network/network.rb +5 -5
  110. data/lib/ronin/network/pop3.rb +5 -5
  111. data/lib/ronin/network/proxy.rb +5 -5
  112. data/lib/ronin/network/smtp.rb +5 -5
  113. data/lib/ronin/network/smtp/email.rb +6 -6
  114. data/lib/ronin/network/smtp/smtp.rb +5 -5
  115. data/lib/ronin/network/ssl.rb +7 -7
  116. data/lib/ronin/network/tcp.rb +5 -5
  117. data/lib/ronin/network/tcp/proxy.rb +5 -5
  118. data/lib/ronin/network/tcp/tcp.rb +32 -23
  119. data/lib/ronin/network/telnet.rb +7 -5
  120. data/lib/ronin/network/udp.rb +5 -5
  121. data/lib/ronin/network/udp/proxy.rb +5 -5
  122. data/lib/ronin/network/udp/udp.rb +28 -26
  123. data/lib/ronin/network/unix.rb +7 -7
  124. data/lib/ronin/path.rb +32 -36
  125. data/lib/ronin/spec/ui/output.rb +5 -5
  126. data/lib/ronin/support.rb +5 -5
  127. data/lib/ronin/support/inflector.rb +5 -5
  128. data/lib/ronin/support/support.rb +5 -5
  129. data/lib/ronin/support/version.rb +6 -6
  130. data/lib/ronin/templates.rb +5 -5
  131. data/lib/ronin/templates/erb.rb +5 -5
  132. data/lib/ronin/templates/template.rb +5 -5
  133. data/lib/ronin/ui/output.rb +5 -5
  134. data/lib/ronin/ui/output/helpers.rb +5 -5
  135. data/lib/ronin/ui/output/output.rb +17 -21
  136. data/lib/ronin/ui/output/terminal.rb +5 -5
  137. data/lib/ronin/ui/output/terminal/color.rb +5 -5
  138. data/lib/ronin/ui/output/terminal/raw.rb +5 -5
  139. data/lib/ronin/ui/shell.rb +5 -5
  140. data/lib/ronin/wordlist.rb +7 -7
  141. data/ronin-support.gemspec +1 -0
  142. data/spec/binary/hexdump/parser_spec.rb +22 -22
  143. data/spec/binary/struct_spec.rb +56 -56
  144. data/spec/binary/template_spec.rb +106 -104
  145. data/spec/extensions/enumerable_spec.rb +4 -4
  146. data/spec/extensions/file_spec.rb +12 -14
  147. data/spec/extensions/ip_addr_spec.rb +30 -30
  148. data/spec/extensions/kernel_spec.rb +7 -7
  149. data/spec/extensions/regexp_spec.rb +69 -69
  150. data/spec/extensions/resolv_spec.rb +2 -2
  151. data/spec/extensions/string_spec.rb +30 -29
  152. data/spec/formatting/binary/array_spec.rb +2 -2
  153. data/spec/formatting/binary/base64_spec.rb +8 -8
  154. data/spec/formatting/binary/float_spec.rb +6 -4
  155. data/spec/formatting/binary/integer_spec.rb +25 -25
  156. data/spec/formatting/binary/string_spec.rb +32 -30
  157. data/spec/formatting/digest/string_spec.rb +5 -5
  158. data/spec/formatting/html/integer_spec.rb +6 -6
  159. data/spec/formatting/html/string_spec.rb +10 -10
  160. data/spec/formatting/http/integer_spec.rb +3 -3
  161. data/spec/formatting/http/string_spec.rb +5 -5
  162. data/spec/formatting/sql/string_spec.rb +21 -19
  163. data/spec/formatting/text/array_spec.rb +15 -15
  164. data/spec/formatting/text/string_spec.rb +33 -33
  165. data/spec/fuzzing/extensions/string_spec.rb +11 -11
  166. data/spec/fuzzing/fuzzer_spec.rb +15 -15
  167. data/spec/fuzzing/fuzzing_spec.rb +5 -5
  168. data/spec/fuzzing/mutator_spec.rb +15 -15
  169. data/spec/fuzzing/repeater_spec.rb +7 -7
  170. data/spec/fuzzing/template_spec.rb +11 -11
  171. data/spec/mixin_spec.rb +10 -12
  172. data/spec/network/dns_spec.rb +34 -32
  173. data/spec/network/ftp_spec.rb +9 -9
  174. data/spec/network/http/http_spec.rb +237 -144
  175. data/spec/network/http/proxy_spec.rb +37 -37
  176. data/spec/network/network_spec.rb +1 -1
  177. data/spec/network/proxy_spec.rb +19 -19
  178. data/spec/network/smtp/email_spec.rb +14 -14
  179. data/spec/network/ssl_spec.rb +9 -9
  180. data/spec/network/tcp/proxy_spec.rb +9 -7
  181. data/spec/network/tcp/tcp_spec.rb +161 -118
  182. data/spec/network/telnet_spec.rb +5 -5
  183. data/spec/network/udp/udp_spec.rb +123 -96
  184. data/spec/network/unix_spec.rb +24 -25
  185. data/spec/path_spec.rb +43 -18
  186. data/spec/spec_helper.rb +0 -1
  187. data/spec/support/inflector_spec.rb +4 -4
  188. data/spec/support_spec.rb +1 -1
  189. data/spec/templates/erb_spec.rb +3 -3
  190. data/spec/templates/template_spec.rb +10 -10
  191. data/spec/ui/shell_spec.rb +15 -15
  192. data/spec/wordlist_spec.rb +19 -19
  193. metadata +408 -366
  194. data/.gemtest +0 -0
@@ -30,7 +30,7 @@ describe String do
30
30
  let(:digest_md5) { "098f6bcd4621d373cade4e832627b4f6" }
31
31
 
32
32
  it "should return the MD5 digest of itself" do
33
- subject.md5.should == digest_md5
33
+ expect(subject.md5).to eq(digest_md5)
34
34
  end
35
35
  end
36
36
 
@@ -40,7 +40,7 @@ describe String do
40
40
  let(:digest_sha1) { "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3" }
41
41
 
42
42
  it "should return the SHA1 digest of itself" do
43
- subject.sha1.should == digest_sha1
43
+ expect(subject.sha1).to eq(digest_sha1)
44
44
  end
45
45
  end
46
46
 
@@ -52,7 +52,7 @@ describe String do
52
52
  end
53
53
 
54
54
  it "should return the SHA2 digest of itself" do
55
- subject.sha2.should == digest_sha2
55
+ expect(subject.sha2).to eq(digest_sha2)
56
56
  end
57
57
  end
58
58
 
@@ -64,7 +64,7 @@ describe String do
64
64
  end
65
65
 
66
66
  it "should return the SHA256 digest of itself" do
67
- subject.sha256.should == digest_sha256
67
+ expect(subject.sha256).to eq(digest_sha256)
68
68
  end
69
69
  end
70
70
 
@@ -76,7 +76,7 @@ describe String do
76
76
  end
77
77
 
78
78
  it "should return the SHA512 digest of itself" do
79
- subject.sha512.should == digest_sha512
79
+ expect(subject.sha512).to eq(digest_sha512)
80
80
  end
81
81
  end
82
82
  end
@@ -24,7 +24,7 @@ describe Integer do
24
24
  let(:html_escaped) { "&" }
25
25
 
26
26
  it "should HTML escape itself" do
27
- subject.html_escape.should == html_escaped
27
+ expect(subject.html_escape).to eq(html_escaped)
28
28
  end
29
29
  end
30
30
 
@@ -32,7 +32,7 @@ describe Integer do
32
32
  let(:formatted_html) { "&" }
33
33
 
34
34
  it "should HTML format all chars" do
35
- subject.format_html.should == formatted_html
35
+ expect(subject.format_html).to eq(formatted_html)
36
36
  end
37
37
  end
38
38
 
@@ -44,11 +44,11 @@ describe Integer do
44
44
  let(:normal_char) { 'A' }
45
45
 
46
46
  it "should escape special JavaScript characters" do
47
- special_byte.js_escape.should == escaped_special_byte
47
+ expect(special_byte.js_escape).to eq(escaped_special_byte)
48
48
  end
49
49
 
50
50
  it "should ignore normal characters" do
51
- normal_byte.js_escape.should == normal_char
51
+ expect(normal_byte.js_escape).to eq(normal_char)
52
52
  end
53
53
  end
54
54
 
@@ -56,11 +56,11 @@ describe Integer do
56
56
  let(:js_escaped) { '\x26' }
57
57
 
58
58
  it "should JavaScript format ascii bytes" do
59
- subject.format_js.should == js_escaped
59
+ expect(subject.format_js).to eq(js_escaped)
60
60
  end
61
61
 
62
62
  it "should JavaScript format unicode bytes" do
63
- 0xd556.format_js.should == '\uD556'
63
+ expect(0xd556.format_js).to eq('\uD556')
64
64
  end
65
65
  end
66
66
  end
@@ -32,7 +32,7 @@ describe String do
32
32
  let(:html_escaped) { "one & two" }
33
33
 
34
34
  it "should HTML escape itself" do
35
- subject.html_escape.should == html_escaped
35
+ expect(subject.html_escape).to eq(html_escaped)
36
36
  end
37
37
  end
38
38
 
@@ -40,7 +40,7 @@ describe String do
40
40
  let(:html_escaped) { "one & two" }
41
41
 
42
42
  it "should HTML unescape itself" do
43
- html_escaped.html_unescape.should == subject
43
+ expect(html_escaped.html_unescape).to eq(subject)
44
44
  end
45
45
  end
46
46
 
@@ -50,7 +50,7 @@ describe String do
50
50
  end
51
51
 
52
52
  it "should HTML format all chars" do
53
- subject.format_html.should == formatted_html
53
+ expect(subject.format_html).to eq(formatted_html)
54
54
  end
55
55
  end
56
56
 
@@ -61,11 +61,11 @@ describe String do
61
61
  let(:normal_chars) { "abc" }
62
62
 
63
63
  it "should escape special JavaScript characters" do
64
- special_chars.js_escape.should == escaped_special_chars
64
+ expect(special_chars.js_escape).to eq(escaped_special_chars)
65
65
  end
66
66
 
67
67
  it "should ignore normal characters" do
68
- normal_chars.js_escape.should == normal_chars
68
+ expect(normal_chars.js_escape).to eq(normal_chars)
69
69
  end
70
70
  end
71
71
 
@@ -77,19 +77,19 @@ describe String do
77
77
  let(:js_mixed) { "%u6F%u6E%u65 %26 two" }
78
78
 
79
79
  it "should unescape JavaScript unicode characters" do
80
- js_unicode.js_unescape.should == subject
80
+ expect(js_unicode.js_unescape).to eq(subject)
81
81
  end
82
82
 
83
83
  it "should unescape JavaScript hex characters" do
84
- js_hex.js_unescape.should == subject
84
+ expect(js_hex.js_unescape).to eq(subject)
85
85
  end
86
86
 
87
87
  it "should unescape backslash-escaped characters" do
88
- "\\b\\t\\n\\f\\r\\\"\\\\".js_unescape.should == "\b\t\n\f\r\"\\"
88
+ expect("\\b\\t\\n\\f\\r\\\"\\\\".js_unescape).to eq("\b\t\n\f\r\"\\")
89
89
  end
90
90
 
91
91
  it "should ignore non-escaped characters" do
92
- js_mixed.js_unescape.should == subject
92
+ expect(js_mixed.js_unescape).to eq(subject)
93
93
  end
94
94
  end
95
95
 
@@ -97,7 +97,7 @@ describe String do
97
97
  let(:js_formatted) { '\x6F\x6E\x65\x20\x26\x20\x74\x77\x6F' }
98
98
 
99
99
  it "should JavaScript escape all characters" do
100
- subject.format_js.should == js_formatted
100
+ expect(subject.format_js).to eq(js_formatted)
101
101
  end
102
102
  end
103
103
  end
@@ -20,7 +20,7 @@ describe Integer do
20
20
  let(:uri_encoded) { '%20' }
21
21
 
22
22
  it "should URI encode itself" do
23
- subject.uri_encode.should == uri_encoded
23
+ expect(subject.uri_encode).to eq(uri_encoded)
24
24
  end
25
25
  end
26
26
 
@@ -28,7 +28,7 @@ describe Integer do
28
28
  let(:uri_escaped) { '+' }
29
29
 
30
30
  it "should URI escape itself" do
31
- subject.uri_escape.should == uri_escaped
31
+ expect(subject.uri_escape).to eq(uri_escaped)
32
32
  end
33
33
  end
34
34
 
@@ -36,7 +36,7 @@ describe Integer do
36
36
  let(:http_formatted) { '%20' }
37
37
 
38
38
  it "should format the byte" do
39
- subject.format_http.should == http_formatted
39
+ expect(subject.format_http).to eq(http_formatted)
40
40
  end
41
41
  end
42
42
  end
@@ -30,7 +30,7 @@ describe String do
30
30
  let(:uri_encoded) { "mod%20%25%203" }
31
31
 
32
32
  it "should URI encode itself" do
33
- subject.uri_encode.should == uri_encoded
33
+ expect(subject.uri_encode).to eq(uri_encoded)
34
34
  end
35
35
  end
36
36
 
@@ -40,7 +40,7 @@ describe String do
40
40
  let(:uri_decoded) { "mod % 3" }
41
41
 
42
42
  it "should URI decode itself" do
43
- subject.uri_decode.should == uri_decoded
43
+ expect(subject.uri_decode).to eq(uri_decoded)
44
44
  end
45
45
  end
46
46
 
@@ -50,7 +50,7 @@ describe String do
50
50
  let(:uri_escaped) { "x+%2B+y" }
51
51
 
52
52
  it "should URI escape itself" do
53
- subject.uri_escape.should == uri_escaped
53
+ expect(subject.uri_escape).to eq(uri_escaped)
54
54
  end
55
55
  end
56
56
 
@@ -60,7 +60,7 @@ describe String do
60
60
  let(:uri_unescaped) { "x + y" }
61
61
 
62
62
  it "should URI unescape itself" do
63
- subject.uri_unescape.should == uri_unescaped
63
+ expect(subject.uri_unescape).to eq(uri_unescaped)
64
64
  end
65
65
  end
66
66
 
@@ -70,7 +70,7 @@ describe String do
70
70
  let(:http_formatted) { "%6D%6F%64%20%25%20%33" }
71
71
 
72
72
  it "should format each byte of the String" do
73
- subject.format_http.should == http_formatted
73
+ expect(subject.format_http).to eq(http_formatted)
74
74
  end
75
75
  end
76
76
  end
@@ -2,73 +2,75 @@ require 'spec_helper'
2
2
  require 'ronin/formatting/extensions/sql/string'
3
3
 
4
4
  describe String do
5
- before(:all) do
6
- @string = '/etc/passwd'
7
- @sql_encoded = '0x2f6574632f706173737764'
8
- @string_with_quotes = %{"O'Brian"}
9
- end
5
+ let(:string) {'/etc/passwd' }
6
+ let(:sql_encoded) { '0x2f6574632f706173737764' }
7
+ let(:string_with_quotes) { %{"O'Brian"} }
10
8
 
11
9
  it "should provide the #sql_escape method" do
12
- @string.should respond_to(:sql_escape)
10
+ expect(string).to respond_to(:sql_escape)
13
11
  end
14
12
 
15
13
  it "should provide the #sql_encode method" do
16
- @string.should respond_to(:sql_encode)
14
+ expect(string).to respond_to(:sql_encode)
17
15
  end
18
16
 
19
17
  it "should provide the #sql_decode method" do
20
- @string.should respond_to(:sql_decode)
18
+ expect(string).to respond_to(:sql_decode)
21
19
  end
22
20
 
23
21
  describe "#sql_escape" do
24
22
  it "should be able to single-quote escape" do
25
- @string_with_quotes.sql_escape(:single).should == %{'"O''Brian"'}
23
+ expect(string_with_quotes.sql_escape(:single)).to eq(%{'"O''Brian"'})
26
24
  end
27
25
 
28
26
  it "should be able to double-quote escape" do
29
- @string_with_quotes.sql_escape(:double).should == %{"""O'Brian"""}
27
+ expect(string_with_quotes.sql_escape(:double)).to eq(%{"""O'Brian"""})
28
+ end
29
+
30
+ it "should be able to tick-mark escape" do
31
+ expect(string_with_quotes.sql_escape(:tick)).to eq(%{`"O'Brian"`})
30
32
  end
31
33
  end
32
34
 
33
35
  describe "#sql_encode" do
34
36
  it "should be able to be SQL-hex encoded" do
35
- @string.sql_encode.should == @sql_encoded
37
+ expect(string.sql_encode).to eq(sql_encoded)
36
38
  end
37
39
 
38
40
  it "should return an empty String if empty" do
39
- ''.sql_encode.should == ''
41
+ expect(''.sql_encode).to eq('')
40
42
  end
41
43
  end
42
44
 
43
45
  describe "#sql_decode" do
44
46
  it "should be able to be SQL-hex decoded" do
45
- encoded = @string.sql_encode
47
+ encoded = string.sql_encode
46
48
 
47
- encoded.should == @sql_encoded
48
- encoded.sql_decode.should == @string
49
+ expect(encoded).to eq(sql_encoded)
50
+ expect(encoded.sql_decode).to eq(string)
49
51
  end
50
52
 
51
53
  it "should be able to decode SQL comma-escaping" do
52
- "'Conan O''Brian'".sql_decode.should == "Conan O'Brian"
54
+ expect("'Conan O''Brian'".sql_decode).to eq("Conan O'Brian")
53
55
  end
54
56
  end
55
57
 
56
58
  describe "#sql_inject" do
57
59
  context "when there is a leading quote character" do
58
60
  it "should remove the first and last quote character" do
59
- "'1' OR '1'='1'".sql_inject.should == "1' OR '1'='1"
61
+ expect("'1' OR '1'='1'".sql_inject).to eq("1' OR '1'='1")
60
62
  end
61
63
 
62
64
  context "when there is no matching leading/trailing quote characters" do
63
65
  it "should comment-terminate the String" do
64
- "'1' OR 1=1".sql_inject.should == "1' OR 1=1--"
66
+ expect("'1' OR 1=1".sql_inject).to eq("1' OR 1=1--")
65
67
  end
66
68
  end
67
69
  end
68
70
 
69
71
  context "when there is no leading quote character" do
70
72
  it "should not modify the String" do
71
- "1 OR 1=1".sql_inject.should == "1 OR 1=1"
73
+ expect("1 OR 1=1".sql_inject).to eq("1 OR 1=1")
72
74
  end
73
75
  end
74
76
  end
@@ -31,43 +31,43 @@ describe Array do
31
31
 
32
32
  describe "#bytes" do
33
33
  it "should convert an Array of bytes to an Array of bytes" do
34
- byte_array.bytes.should == byte_array
34
+ expect(byte_array.bytes).to eq(byte_array)
35
35
  end
36
36
 
37
37
  it "should convert an Array of chars to an Array of bytes" do
38
- char_array.bytes.should == byte_array
38
+ expect(char_array.bytes).to eq(byte_array)
39
39
  end
40
40
 
41
41
  it "should safely handle mixed byte/char/string Arrays" do
42
- mixed_array.bytes.should == byte_array
42
+ expect(mixed_array.bytes).to eq(byte_array)
43
43
  end
44
44
  end
45
45
 
46
46
  describe "#chars" do
47
47
  it "should convert an Array of bytes to an Array of chars" do
48
- byte_array.chars.should == char_array
48
+ expect(byte_array.chars).to eq(char_array)
49
49
  end
50
50
 
51
51
  it "should safely convert an Array of chars to an Array of chars" do
52
- char_array.chars.should == char_array
52
+ expect(char_array.chars).to eq(char_array)
53
53
  end
54
54
 
55
55
  it "should safely handle mixed byte/char/string Arrays" do
56
- mixed_array.chars.should == char_array
56
+ expect(mixed_array.chars).to eq(char_array)
57
57
  end
58
58
  end
59
59
 
60
60
  describe "#char_string" do
61
61
  it "should convert an Array of bytes to a String" do
62
- byte_array.char_string.should == string
62
+ expect(byte_array.char_string).to eq(string)
63
63
  end
64
64
 
65
65
  it "should convert an Array of chars to a String" do
66
- char_array.char_string.should == string
66
+ expect(char_array.char_string).to eq(string)
67
67
  end
68
68
 
69
69
  it "should safely handle mixed byte/char/string Arrays" do
70
- mixed_array.char_string.should == string
70
+ expect(mixed_array.char_string).to eq(string)
71
71
  end
72
72
  end
73
73
 
@@ -75,15 +75,15 @@ describe Array do
75
75
  let(:hex_chars) { ['\x41', '\x41', '\x20'] }
76
76
 
77
77
  it "should convert an Array of bytes into hexadecimal chars" do
78
- byte_array.hex_chars.should == hex_chars
78
+ expect(byte_array.hex_chars).to eq(hex_chars)
79
79
  end
80
80
 
81
81
  it "should convert an Array of chars into hexadecimal chars" do
82
- char_array.hex_chars.should == hex_chars
82
+ expect(char_array.hex_chars).to eq(hex_chars)
83
83
  end
84
84
 
85
85
  it "should safely handle mixed byte/char/string Arrays" do
86
- mixed_array.hex_chars.should == hex_chars
86
+ expect(mixed_array.hex_chars).to eq(hex_chars)
87
87
  end
88
88
  end
89
89
 
@@ -91,15 +91,15 @@ describe Array do
91
91
  let(:hex_integers) { ['0x41', '0x41', '0x20'] }
92
92
 
93
93
  it "should convert an Array of bytes into hexadecimal integers" do
94
- byte_array.hex_integers.should == hex_integers
94
+ expect(byte_array.hex_integers).to eq(hex_integers)
95
95
  end
96
96
 
97
97
  it "should convert an Array of chars into hexadecimal integers" do
98
- char_array.hex_integers.should == hex_integers
98
+ expect(char_array.hex_integers).to eq(hex_integers)
99
99
  end
100
100
 
101
101
  it "should safely handle mixed byte/char/string Arrays" do
102
- mixed_array.hex_integers.should == hex_integers
102
+ expect(mixed_array.hex_integers).to eq(hex_integers)
103
103
  end
104
104
  end
105
105
  end
@@ -34,65 +34,65 @@ describe String do
34
34
 
35
35
  describe "#format_bytes" do
36
36
  it "should format each byte in the String" do
37
- subject.format_bytes { |b|
37
+ expect(subject.format_bytes { |b|
38
38
  sprintf("%%%x",b)
39
- }.should == "%68%65%6c%6c%6f"
39
+ }).to eq("%68%65%6c%6c%6f")
40
40
  end
41
41
 
42
42
  it "should format specific bytes in a String" do
43
- subject.format_bytes(:include => [104, 108]) { |b|
43
+ expect(subject.format_bytes(:include => [104, 108]) { |b|
44
44
  b - 32
45
- }.should == 'HeLLo'
45
+ }).to eq('HeLLo')
46
46
  end
47
47
 
48
48
  it "should not format specific bytes in a String" do
49
- subject.format_bytes(:exclude => [101, 111]) { |b|
49
+ expect(subject.format_bytes(:exclude => [101, 111]) { |b|
50
50
  b - 32
51
- }.should == 'HeLLo'
51
+ }).to eq('HeLLo')
52
52
  end
53
53
 
54
54
  it "should format ranges of bytes in a String" do
55
- subject.format_bytes(:include => (104..108)) { |b|
55
+ expect(subject.format_bytes(:include => (104..108)) { |b|
56
56
  b - 32
57
- }.should == 'HeLLo'
57
+ }).to eq('HeLLo')
58
58
  end
59
59
 
60
60
  it "should not format ranges of bytes in a String" do
61
- subject.format_bytes(:exclude => (104..108)) { |b|
61
+ expect(subject.format_bytes(:exclude => (104..108)) { |b|
62
62
  b - 32
63
- }.should == 'hEllO'
63
+ }).to eq('hEllO')
64
64
  end
65
65
  end
66
66
 
67
67
  describe "#format_chars" do
68
68
  it "should format each character in the String" do
69
- subject.format_chars { |c|
69
+ expect(subject.format_chars { |c|
70
70
  "#{c}."
71
- }.should == "h.e.l.l.o."
71
+ }).to eq("h.e.l.l.o.")
72
72
  end
73
73
 
74
74
  it "should format specific chars in a String" do
75
- subject.format_chars(:include => ['h', 'l']) { |c|
75
+ expect(subject.format_chars(:include => ['h', 'l']) { |c|
76
76
  c.upcase
77
- }.should == 'HeLLo'
77
+ }).to eq('HeLLo')
78
78
  end
79
79
 
80
80
  it "should not format specific chars in a String" do
81
- subject.format_chars(:exclude => ['h', 'l']) { |c|
81
+ expect(subject.format_chars(:exclude => ['h', 'l']) { |c|
82
82
  c.upcase
83
- }.should == 'hEllO'
83
+ }).to eq('hEllO')
84
84
  end
85
85
 
86
86
  it "should format ranges of chars in a String" do
87
- subject.format_chars(:include => /[h-l]/) { |c|
87
+ expect(subject.format_chars(:include => /[h-l]/) { |c|
88
88
  c.upcase
89
- }.should == 'HeLLo'
89
+ }).to eq('HeLLo')
90
90
  end
91
91
 
92
92
  it "should not format ranges of chars in a String" do
93
- subject.format_chars(:exclude => /[h-l]/) { |c|
93
+ expect(subject.format_chars(:exclude => /[h-l]/) { |c|
94
94
  c.upcase
95
- }.should == 'hEllO'
95
+ }).to eq('hEllO')
96
96
  end
97
97
  end
98
98
 
@@ -100,63 +100,63 @@ describe String do
100
100
  it "should capitalize each character when :probability is 1.0" do
101
101
  new_string = subject.random_case(:probability => 1.0)
102
102
 
103
- subject.upcase.should == new_string
103
+ expect(subject.upcase).to eq(new_string)
104
104
  end
105
105
 
106
106
  it "should not capitalize any characters when :probability is 0.0" do
107
107
  new_string = subject.random_case(:probability => 0.0)
108
108
 
109
- subject.should == new_string
109
+ expect(subject).to eq(new_string)
110
110
  end
111
111
  end
112
112
 
113
113
  describe "#insert_before" do
114
114
  it "should inject data before a matched String" do
115
- subject.insert_before('ll','x').should == "hexllo"
115
+ expect(subject.insert_before('ll','x')).to eq("hexllo")
116
116
  end
117
117
 
118
118
  it "should inject data before a matched Regexp" do
119
- subject.insert_before(/l+/,'x').should == "hexllo"
119
+ expect(subject.insert_before(/l+/,'x')).to eq("hexllo")
120
120
  end
121
121
 
122
122
  it "should not inject data if no matches are found" do
123
- subject.insert_before(/x/,'x').should == subject
123
+ expect(subject.insert_before(/x/,'x')).to eq(subject)
124
124
  end
125
125
  end
126
126
 
127
127
  describe "#insert_after" do
128
128
  it "should inject data after a matched String" do
129
- subject.insert_after('ll','x').should == "hellxo"
129
+ expect(subject.insert_after('ll','x')).to eq("hellxo")
130
130
  end
131
131
 
132
132
  it "should inject data after a matched Regexp" do
133
- subject.insert_after(/l+/,'x').should == "hellxo"
133
+ expect(subject.insert_after(/l+/,'x')).to eq("hellxo")
134
134
  end
135
135
 
136
136
  it "should not inject data if no matches are found" do
137
- subject.insert_after(/x/,'x').should == subject
137
+ expect(subject.insert_after(/x/,'x')).to eq(subject)
138
138
  end
139
139
  end
140
140
 
141
141
  describe "#unescape" do
142
142
  it "should not unescape a normal String" do
143
- "hello".unescape.should == "hello"
143
+ expect("hello".unescape).to eq("hello")
144
144
  end
145
145
 
146
146
  it "should unescape a hex String" do
147
- "\\x68\\x65\\x6c\\x6c\\x6f\\x4e".unescape.should == "hello\x4e"
147
+ expect("\\x68\\x65\\x6c\\x6c\\x6f\\x4e".unescape).to eq("hello\x4e")
148
148
  end
149
149
 
150
150
  it "should unescape an octal String" do
151
- "hello\012".unescape.should == "hello\n"
151
+ expect("hello\012".unescape).to eq("hello\n")
152
152
  end
153
153
 
154
154
  it "should unescape control characters" do
155
- "hello\\n".unescape.should == "hello\n"
155
+ expect("hello\\n".unescape).to eq("hello\n")
156
156
  end
157
157
 
158
158
  it "should unescape normal characters" do
159
- "hell\\o".unescape.should == "hello"
159
+ expect("hell\\o".unescape).to eq("hello")
160
160
  end
161
161
  end
162
162
  end