From 01cb7bc98177c1dbfa72b585e343e0d8e60ba495 Mon Sep 17 00:00:00 2001 From: Gebhard Woestemeyer Date: Mon, 27 Feb 2017 20:50:13 +0100 Subject: [PATCH] adjust tests for newer rspec version --- spec/signature_spec.rb | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/spec/signature_spec.rb b/spec/signature_spec.rb index aab62ee..1dfa7ff 100644 --- a/spec/signature_spec.rb +++ b/spec/signature_spec.rb @@ -24,38 +24,38 @@ module HMACAuth context 'valid' do let(:timestamp) { 10.minutes.ago.to_i.to_s } - it { should be_true } + it { should be_truthy } end context 'invalid' do let(:timestamp) { 20.minutes.ago.to_i } - it { should be_false } + it { should be_falsy } end end end describe '.sign' do - def signature(hash) - HMACAuth::Signature.sign(hash, secret: secret)['signature'] - end - describe 'hash' do subject { HMACAuth::Signature.sign(params, secret: secret) } - it { should be_a Hash } - its(['signature']) { should be_a String } - its(['timestamp']) { should be } - its(['b']) { should be_a String } + it { expect(subject).to be_a Hash } + it { expect(subject['signature']).to be_a String } + it { expect(subject['timestamp']).to be } + it { expect(subject['b']).to be_a String } context 'nested hash' do subject { HMACAuth::Signature.sign(params, secret: secret)['a'] } - it { should be_a Hash } - its(['d']) { should == '4' } - its(['c']) { should == '3' } + it { expect(subject).to be_a Hash } + it { expect(subject['d']).to eq '4' } + it { expect(subject['c']).to eq '3' } end end describe 'unsorted input' do + def signature(hash) + HMACAuth::Signature.sign(hash, secret: secret)['signature'] + end + let(:hasha) { { a: 1, b: { c: 3, d: 4 } } } let(:hashd) { { b: { d: 4, c: 3 }, a: 1 } }