11require File . dirname ( __FILE__ ) + '/test_helper'
22
3- class NoPrivateKeyErrorTest < Test :: Unit :: TestCase
3+ class NoPrivateKeyErrorTest < Minitest :: Test
44 def test_should_exist
5- assert_not_nil EncryptedStrings ::NoPrivateKeyError
5+ refute_nil EncryptedStrings ::NoPrivateKeyError
66 end
77end
88
9- class NoPublicKeyErrorTest < Test :: Unit :: TestCase
9+ class NoPublicKeyErrorTest < Minitest :: Test
1010 def test_should_exist
11- assert_not_nil EncryptedStrings ::NoPublicKeyError
11+ refute_nil EncryptedStrings ::NoPublicKeyError
1212 end
1313end
1414
15- class AsymmetricCipherByDefaultTest < Test :: Unit :: TestCase
15+ class AsymmetricCipherByDefaultTest < Minitest :: Test
1616 def setup
1717 @asymmetric_cipher = EncryptedStrings ::AsymmetricCipher . new ( :public_key_file => File . dirname ( __FILE__ ) + '/keys/public' )
1818 end
1919
2020 def test_should_raise_an_exception
21- assert_raise ( ArgumentError ) { EncryptedStrings ::AsymmetricCipher . new }
21+ assert_raises ( ArgumentError ) { EncryptedStrings ::AsymmetricCipher . new }
2222 end
2323
2424 def test_should_not_have_a_public_key_file
@@ -39,7 +39,7 @@ def test_should_not_have_a_password
3939 end
4040end
4141
42- class AsymmetricCipherWithCustomDefaultsTest < Test :: Unit :: TestCase
42+ class AsymmetricCipherWithCustomDefaultsTest < Minitest :: Test
4343 def setup
4444 @original_default_public_key_file = EncryptedStrings ::AsymmetricCipher . default_public_key_file
4545 @original_default_private_key_file = EncryptedStrings ::AsymmetricCipher . default_private_key_file
@@ -72,13 +72,13 @@ def teardown
7272 end
7373end
7474
75- class AsymmetricCipherWithInvalidOptionsTest < Test :: Unit :: TestCase
75+ class AsymmetricCipherWithInvalidOptionsTest < Minitest :: Test
7676 def test_should_throw_an_exception
77- assert_raise ( ArgumentError ) { EncryptedStrings ::AsymmetricCipher . new ( :invalid => true ) }
77+ assert_raises ( ArgumentError ) { EncryptedStrings ::AsymmetricCipher . new ( :invalid => true ) }
7878 end
7979end
8080
81- class AsymmetricCipherTest < Test :: Unit :: TestCase
81+ class AsymmetricCipherTest < Minitest :: Test
8282 def setup
8383 @asymmetric_cipher = EncryptedStrings ::AsymmetricCipher . new ( :public_key_file => File . dirname ( __FILE__ ) + '/keys/public' )
8484 end
@@ -88,7 +88,7 @@ def test_should_be_able_to_decrypt
8888 end
8989end
9090
91- class AsymmetricCipherWithoutPublicKeyTest < Test :: Unit :: TestCase
91+ class AsymmetricCipherWithoutPublicKeyTest < Minitest :: Test
9292 def setup
9393 @asymmetric_cipher = EncryptedStrings ::AsymmetricCipher . new ( :public_key_file => nil , :private_key_file => File . dirname ( __FILE__ ) + '/keys/private' )
9494 end
@@ -98,11 +98,11 @@ def test_should_not_be_public
9898 end
9999
100100 def test_should_not_be_able_to_encrypt
101- assert_raise ( EncryptedStrings ::NoPublicKeyError ) { @asymmetric_cipher . encrypt ( 'test' ) }
101+ assert_raises ( EncryptedStrings ::NoPublicKeyError ) { @asymmetric_cipher . encrypt ( 'test' ) }
102102 end
103103end
104104
105- class AsymmetricCipherWithPublicKeyTest < Test :: Unit :: TestCase
105+ class AsymmetricCipherWithPublicKeyTest < Minitest :: Test
106106 def setup
107107 @asymmetric_cipher = EncryptedStrings ::AsymmetricCipher . new ( :public_key_file => File . dirname ( __FILE__ ) + '/keys/public' )
108108 end
@@ -120,11 +120,11 @@ def test_should_be_able_to_encrypt
120120 end
121121
122122 def test_should_not_be_able_to_decrypt
123- assert_raise ( EncryptedStrings ::NoPrivateKeyError ) { @asymmetric_cipher . decrypt ( "HbEh0Hwri26S7SWYqO26DBbzfhR1h/0pXYLjSKUpxF5DOaOCtD9oRN748+Na\n rfNaVN5Eg7RUhbRFZE+UnNHo6Q==\n " ) }
123+ assert_raises ( EncryptedStrings ::NoPrivateKeyError ) { @asymmetric_cipher . decrypt ( "HbEh0Hwri26S7SWYqO26DBbzfhR1h/0pXYLjSKUpxF5DOaOCtD9oRN748+Na\n rfNaVN5Eg7RUhbRFZE+UnNHo6Q==\n " ) }
124124 end
125125end
126126
127- class AsymmetricCipherWithoutPrivateKeyTest < Test :: Unit :: TestCase
127+ class AsymmetricCipherWithoutPrivateKeyTest < Minitest :: Test
128128 def setup
129129 @asymmetric_cipher = EncryptedStrings ::AsymmetricCipher . new ( :private_key_file => nil , :public_key_file => File . dirname ( __FILE__ ) + '/keys/public' )
130130 end
@@ -134,11 +134,11 @@ def test_should_not_be_private
134134 end
135135
136136 def test_should_not_be_able_to_decrypt
137- assert_raise ( EncryptedStrings ::NoPrivateKeyError ) { @asymmetric_cipher . decrypt ( "HbEh0Hwri26S7SWYqO26DBbzfhR1h/0pXYLjSKUpxF5DOaOCtD9oRN748+Na\n rfNaVN5Eg7RUhbRFZE+UnNHo6Q==\n " ) }
137+ assert_raises ( EncryptedStrings ::NoPrivateKeyError ) { @asymmetric_cipher . decrypt ( "HbEh0Hwri26S7SWYqO26DBbzfhR1h/0pXYLjSKUpxF5DOaOCtD9oRN748+Na\n rfNaVN5Eg7RUhbRFZE+UnNHo6Q==\n " ) }
138138 end
139139end
140140
141- class AsymmetricCipherWithPrivateKeyTest < Test :: Unit :: TestCase
141+ class AsymmetricCipherWithPrivateKeyTest < Minitest :: Test
142142 def setup
143143 @asymmetric_cipher = EncryptedStrings ::AsymmetricCipher . new ( :private_key_file => File . dirname ( __FILE__ ) + '/keys/private' )
144144 end
@@ -152,15 +152,15 @@ def test_should_be_private
152152 end
153153
154154 def test_not_should_be_able_to_encrypt
155- assert_raise ( EncryptedStrings ::NoPublicKeyError ) { @asymmetric_cipher . encrypt ( 'test' ) }
155+ assert_raises ( EncryptedStrings ::NoPublicKeyError ) { @asymmetric_cipher . encrypt ( 'test' ) }
156156 end
157157
158158 def test_should_be_able_to_decrypt
159159 assert_equal 'test' , @asymmetric_cipher . decrypt ( "HbEh0Hwri26S7SWYqO26DBbzfhR1h/0pXYLjSKUpxF5DOaOCtD9oRN748+Na\n rfNaVN5Eg7RUhbRFZE+UnNHo6Q==\n " )
160160 end
161161end
162162
163- class AsymmetricCipherWithEncryptedPrivateKeyTest < Test :: Unit :: TestCase
163+ class AsymmetricCipherWithEncryptedPrivateKeyTest < Minitest :: Test
164164 def setup
165165 @asymmetric_cipher = EncryptedStrings ::AsymmetricCipher . new ( :private_key_file => File . dirname ( __FILE__ ) + '/keys/encrypted_private' , :algorithm => 'DES-EDE3-CBC' , :password => 'secret' )
166166 end
@@ -174,7 +174,7 @@ def test_should_be_private
174174 end
175175
176176 def test_should_not_be_able_to_encrypt
177- assert_raise ( EncryptedStrings ::NoPublicKeyError ) { @asymmetric_cipher . encrypt ( 'test' ) }
177+ assert_raises ( EncryptedStrings ::NoPublicKeyError ) { @asymmetric_cipher . encrypt ( 'test' ) }
178178 end
179179
180180 def test_should_be_able_to_decrypt
0 commit comments