spec/sixword/hex_spec.rb in sixword-0.3.1 vs spec/sixword/hex_spec.rb in sixword-0.3.2

- old
+ new

@@ -1,9 +1,8 @@ # coding: binary -require_relative '../rspec_helper' -describe Sixword::Hex do +RSpec.describe Sixword::Hex do TestCases = { "\x73\xe2\x16\xb5\x36\x3f\x23\x77" => [ "73e216b5363f2377", "73E2 16B5 363F 2377", "73:e2:16:b5:36:3f:23:77", @@ -86,40 +85,40 @@ ], } it 'should decode and encode random hex strings correctly' do TestCases.each do |binary, hexes| - lower, finger, colons = hexes - Sixword::Hex.encode(binary).should == lower - Sixword::Hex.decode(lower).should == binary + lower, _finger, _colons = hexes + expect(Sixword::Hex.encode(binary)).to eq(lower) + expect(Sixword::Hex.decode(lower)).to eq(binary) end end it 'should decode and encode random hex fingerprints correctly' do TestCases.each do |binary, hexes| - lower, finger, colons = hexes - Sixword::Hex.encode_fingerprint(binary).should == finger - Sixword::Hex.decode(finger).should == binary + _lower, finger, _colons = hexes + expect(Sixword::Hex.encode_fingerprint(binary)).to eq(finger) + expect(Sixword::Hex.decode(finger)).to eq(binary) end end it 'should decode and encode random colon hexes correctly' do TestCases.each do |binary, hexes| - lower, finger, colons = hexes - Sixword::Hex.encode_colons(binary).should == colons - Sixword::Hex.decode(colons).should == binary + _lower, _finger, colons = hexes + expect(Sixword::Hex.encode_colons(binary)).to eq(colons) + expect(Sixword::Hex.decode(colons)).to eq(binary) end end it 'should accept all valid hex characters' do - Sixword::Hex.valid_hex?('abcdefABCDEF0123456789').should == true + expect(Sixword::Hex.valid_hex?('abcdefABCDEF0123456789')).to eq(true) end it 'should reject invalid hex characters' do ('g'..'z').each do |c| - Sixword::Hex.valid_hex?(c).should == false + expect(Sixword::Hex.valid_hex?(c)).to eq(false) end ('G'..'Z').each do |c| - Sixword::Hex.valid_hex?(c).should == false + expect(Sixword::Hex.valid_hex?(c)).to eq(false) end end end