diff options
Diffstat (limited to 'spec/ruby')
-rw-r--r-- | spec/ruby/library/openssl/config/freeze_spec.rb | 27 | ||||
-rw-r--r-- | spec/ruby/library/openssl/shared/version.rb | 16 |
2 files changed, 31 insertions, 12 deletions
diff --git a/spec/ruby/library/openssl/config/freeze_spec.rb b/spec/ruby/library/openssl/config/freeze_spec.rb index 1876095d9f..d63c243d72 100644 --- a/spec/ruby/library/openssl/config/freeze_spec.rb +++ b/spec/ruby/library/openssl/config/freeze_spec.rb @@ -1,20 +1,23 @@ require_relative '../../../spec_helper' require_relative '../shared/constants' +require_relative '../shared/version' require 'openssl' -describe "OpenSSL::Config#freeze" do - it "needs to be reviewed for completeness" +openssl_version_is(""..."2.2") do + describe "OpenSSL::Config#freeze" do + it "needs to be reviewed for completeness" - it "freezes" do - c = OpenSSL::Config.new - -> { - c['foo'] = [ ['key', 'value'] ] - }.should_not raise_error - c.freeze - c.frozen?.should be_true - -> { - c['foo'] = [ ['key', 'value'] ] - }.should raise_error(TypeError) + it "freezes" do + c = OpenSSL::Config.new + -> { + c['foo'] = [ ['key', 'value'] ] + }.should_not raise_error + c.freeze + c.frozen?.should be_true + -> { + c['foo'] = [ ['key', 'value'] ] + }.should raise_error(TypeError) + end end end diff --git a/spec/ruby/library/openssl/shared/version.rb b/spec/ruby/library/openssl/shared/version.rb new file mode 100644 index 0000000000..63837d3375 --- /dev/null +++ b/spec/ruby/library/openssl/shared/version.rb @@ -0,0 +1,16 @@ +require 'openssl' + +class OpenSSLVersionGuard < VersionGuard + FULL_OPENSSL_VERSION = SpecVersion.new OpenSSL::VERSION + def match? + if Range === @version + @version.include? FULL_OPENSSL_VERSION + else + FULL_OPENSSL_VERSION >= @version + end + end +end + +def openssl_version_is(*args, &block) + OpenSSLVersionGuard.new(*args).run_if(:openssl_version_is, &block) +end |