Skip to content

Commit

Permalink
adjust tests for newer rspec version
Browse files Browse the repository at this point in the history
  • Loading branch information
gewo committed Feb 27, 2017
1 parent 7123e95 commit 01cb7bc
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions spec/signature_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 } }

Expand Down

0 comments on commit 01cb7bc

Please sign in to comment.