Skip to content

Commit

Permalink
Merge 2ae2308 into 492559e
Browse files Browse the repository at this point in the history
  • Loading branch information
David FRANCOIS committed Dec 30, 2014
2 parents 492559e + 2ae2308 commit d34c142
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
4 changes: 3 additions & 1 deletion gpgme.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ encryption, decryption, signing, signature verification and key management.}
s.add_development_dependency "coveralls"

case RUBY_VERSION
when /\A1\.9\.2/, /\A1\.9\.3/, /\A2\./
when /\A1\.9\.2/, /\A1\.9\.3/
s.add_development_dependency "debugger" , "~> 1.6.6"
when /\A1\.9\./
s.add_development_dependency "ruby-debug19" , "~> 0.11.6"
when /\A2\./
s.add_development_dependency "byebug" , "~> 3.5.1"
else
s.add_development_dependency "ruby-debug" , "~> 0.10.4"
end
Expand Down
22 changes: 22 additions & 0 deletions test/ctx_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,28 @@ def checking_value(value,par2,par3,par4,fd)
# it ":progress_callback_value"
end

describe :decrypt_result do
it "returns the list of encyption recipients" do
cipher = GPGME::Data.new(KEY_1_ENCRYPTED)
output = GPGME::Data.new

GPGME::Ctx.new do |ctx|
ctx.decrypt_verify(cipher, output)
assert_equal 1, ctx.decrypt_result.recipients.size
end
end

# it "should not segfault" do
# cipher = GPGME::Data.new(KEY_1_ENCRYPTED)
# ouput = GPGME::Data.new
#
# GPGME::Ctx.new do |ctx|
# # This should fail more gracefully
# ctx.decrypt_result
# end
# end
end

describe :armor do
it "sets false by default" do
ctx = GPGME::Ctx.new
Expand Down
16 changes: 16 additions & 0 deletions test/support/resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,8 @@
KEYS << { :sha => 'test3@example.com', :public => key3_public, :secret => key3_secret}
KEYS << { :sha => 'test4@example.com', :public => key4_public, :secret => key4_secret}

PLAIN_KEY = { :sha => 'test1@example.com', :public => key1_public, :secret => key1_secret }

PASSWORD_KEY = {
:sha => 'test_with_password@example.com',
:public => password_key_public,
Expand All @@ -514,3 +516,17 @@
:passwored => passwored.chomp,
:expired_key_sign => signed_with_expired_key_text.chomp
}

KEY_1_ENCRYPTED = <<-RUBY
-----BEGIN PGP MESSAGE-----
Version: GnuPG v1
hIwDbJ4P+uQnvtQBBACOzUqiKHRS8cEDPpQl1dQznpxcWW3Md8X3eFRx3+qD0X7+
aEadz/cUXf7nO9KimeO7qhqNBJoPQEzZTqirebLgq2pq+Rtp2zGCvU1hUnAmVm27
CZE/quNaBV33V0haddWm4Y8AD7e7T2a2LBDrMNGsD9eKjREJ+g/Pmm5WLRDx69JP
AaXe0Msjfyapj07hCPZptE8iP2/tCSvRDmiSgidPAZM4NnL2ANwfT6kslVha0mos
MH+qcPlxAMrMnjuWs+wFiVnWLEYfIqNzH7Z2irC2NA==
=O59i
-----END PGP MESSAGE-----
RUBY

7 changes: 6 additions & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@
require 'minitest/spec'
require 'minitest/pride'
require 'mocha'
require 'ruby-debug'
require 'gpgme'

if RUBY_VERSION.split('.').first.to_i > 1
require 'byebug'
else
require 'ruby-debug'
end

require File.dirname(__FILE__) + "/support/resources"


Expand Down

0 comments on commit d34c142

Please sign in to comment.