spec/r509_spec.rb in r509-0.10.0 vs spec/r509_spec.rb in r509-1.0
- old
+ new
@@ -1,34 +1,34 @@
require 'spec_helper'
-def capture_stdout(&block)
+def capture_stdout
original_stdout = $stdout
- $stdout = fake = StringIO.new
- begin
- yield
- ensure
- $stdout = original_stdout
- end
- fake.string
+ $stdout = fake = StringIO.new
+ begin
+ yield
+ ensure
+ $stdout = original_stdout
+ end
+ fake.string
end
describe R509 do
it "prints version and feature info with ::print_debug" do
output = capture_stdout { R509.print_debug }
- output.should match /^r509 v/
- output.should match /^OpenSSL/
- output.should match /^Ruby/
- output.should match /^Elliptic/
+ expect(output).to match(/^r509 v/)
+ expect(output).to match(/^OpenSSL/)
+ expect(output).to match(/^Ruby/)
+ expect(output).to match(/^Elliptic/)
end
it "checks if ec is supported", :ec => true do
- R509.ec_supported?.should == true
+ expect(R509.ec_supported?).to eq(true)
end
it "checks if EC is unsupported" do
- ec = OpenSSL::PKey.send(:remove_const,:EC) # remove EC support for test!
+ ec = OpenSSL::PKey.send(:remove_const, :EC) # remove EC support for test!
load('r509/ec-hack.rb')
- R509.ec_supported?.should == false
+ expect(R509.ec_supported?).to eq(false)
expect { OpenSSL::PKey::EC.new }.to raise_error(R509::R509Error)
- OpenSSL::PKey.send(:remove_const,:EC) # remove stubbed EC
+ OpenSSL::PKey.send(:remove_const, :EC) # remove stubbed EC
OpenSSL::PKey::EC = ec # add the real one back
# this pretty fragile. if the expectation fails then we don't fix the EC class assignment
# so any spec called after this will fail improperly.
end
end