From dccf02184fdc340a76fcb9bc61ed2aa5cd4160fa Mon Sep 17 00:00:00 2001 From: mokha Date: Fri, 8 Jun 2018 18:35:29 -0600 Subject: extract context. --- spec/storage_spec.rb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'spec') diff --git a/spec/storage_spec.rb b/spec/storage_spec.rb index e665e42..3e9b543 100644 --- a/spec/storage_spec.rb +++ b/spec/storage_spec.rb @@ -5,10 +5,16 @@ RSpec.describe Locker::Storage do subject { described_class.new } let(:api_key) { SecureRandom.hex(32) } - it 'fetches the value that was previously stored' do - subject.store('development.api_key', api_key) - result = subject.fetch('development.api_key') - expect(result).to eql(api_key) + context "when several items are in storage" do + before :each do + subject.store('development.api_key', api_key) + subject.store('test.api_key', SecureRandom.hex(32)) + subject.store('production.api_key', SecureRandom.hex(32)) + end + + it 'fetches the value that was previously stored' do + expect(subject.fetch('development.api_key')).to eql(api_key) + end end end end -- cgit v1.2.3