test/encryptor_test.rb in encryptor-1.0.1 vs test/encryptor_test.rb in encryptor-1.1.0
- old
+ new
@@ -9,35 +9,35 @@
key = Digest::SHA256.hexdigest(([Time.now.to_s] * rand(3)).join)
iv = Digest::SHA256.hexdigest(([Time.now.to_s] * rand(3)).join)
algorithms.each do |algorithm|
define_method "test_should_crypt_with_#{algorithm}_algorithm_with_iv" do
- encrypted_value = Huberry::Encryptor.encrypt(:value => original_value, :key => key, :iv => iv, :algorithm => algorithm)
+ encrypted_value = Encryptor.encrypt(:value => original_value, :key => key, :iv => iv, :algorithm => algorithm)
assert_not_equal original_value, encrypted_value
- assert_not_equal Huberry::Encryptor.encrypt(:value => original_value, :key => key, :algorithm => algorithm), encrypted_value
- assert_equal original_value, Huberry::Encryptor.decrypt(:value => encrypted_value, :key => key, :iv => iv, :algorithm => algorithm)
+ assert_not_equal Encryptor.encrypt(:value => original_value, :key => key, :algorithm => algorithm), encrypted_value
+ assert_equal original_value, Encryptor.decrypt(:value => encrypted_value, :key => key, :iv => iv, :algorithm => algorithm)
end
define_method "test_should_crypt_with_#{algorithm}_algorithm_without_iv" do
- encrypted_value = Huberry::Encryptor.encrypt(:value => original_value, :key => key, :algorithm => algorithm)
+ encrypted_value = Encryptor.encrypt(:value => original_value, :key => key, :algorithm => algorithm)
assert_not_equal original_value, encrypted_value
- assert_equal original_value, Huberry::Encryptor.decrypt(:value => encrypted_value, :key => key, :algorithm => algorithm)
+ assert_equal original_value, Encryptor.decrypt(:value => encrypted_value, :key => key, :algorithm => algorithm)
end
end
define_method 'test_should_have_a_default_algorithm' do
- assert algorithms.include?(Huberry::Encryptor.default_options[:algorithm])
+ assert algorithms.include?(Encryptor.default_options[:algorithm])
end
define_method 'test_should_use_the_default_algorithm_if_one_is_not_specified' do
- assert_equal Huberry::Encryptor.encrypt(:value => original_value, :key => key, :algorithm => Huberry::Encryptor.default_options[:algorithm]), Huberry::Encryptor.encrypt(:value => original_value, :key => key)
+ assert_equal Encryptor.encrypt(:value => original_value, :key => key, :algorithm => Encryptor.default_options[:algorithm]), Encryptor.encrypt(:value => original_value, :key => key)
end
def test_should_be_able_to_change_the_default_algorithm
- original_algorithm = Huberry::Encryptor.default_options[:algorithm]
+ original_algorithm = Encryptor.default_options[:algorithm]
assert_not_equal 'test', original_algorithm
- Huberry::Encryptor.default_options[:algorithm] = 'test'
- assert_equal 'test', Huberry::Encryptor.default_options[:algorithm]
- Huberry::Encryptor.default_options[:algorithm] = original_algorithm
+ Encryptor.default_options[:algorithm] = 'test'
+ assert_equal 'test', Encryptor.default_options[:algorithm]
+ Encryptor.default_options[:algorithm] = original_algorithm
end
end
\ No newline at end of file