From fddc165d86b02aeb8defd067e402517242d089fa Mon Sep 17 00:00:00 2001 From: Ryan Lue Date: Thu, 23 Aug 2018 13:02:09 +0800 Subject: [PATCH] Clarify RSpec example cases --- spec/lib/import/exchange/folder_spec.rb | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/spec/lib/import/exchange/folder_spec.rb b/spec/lib/import/exchange/folder_spec.rb index 4ef066f3f..3ac924fdc 100644 --- a/spec/lib/import/exchange/folder_spec.rb +++ b/spec/lib/import/exchange/folder_spec.rb @@ -25,10 +25,22 @@ RSpec.describe Import::Exchange::Folder do allow(subject).to receive(:find).with(nil).and_return(nil) end - it 'returns a valid UTF-8 string' do - expect(subject.display_path(root_folder)).to eq('Root') - expect(subject.display_path(child_folder)).to eq('Root -> Leaf') - expect(subject.display_path(exception_case)).to eq('Error-Raising Leaf') + context 'and target folder is directory root' do + it 'returns the display name of the folder' do + expect(subject.display_path(root_folder)).to eq('Root') + end + end + + context 'and target folder is NOT directory root' do + it 'returns the full path from root to target' do + expect(subject.display_path(child_folder)).to eq('Root -> Leaf') + end + end + + context 'and walking up directory tree raises EwsError' do + it 'returns the partial path from error to target folder' do + expect(subject.display_path(exception_case)).to eq('Error-Raising Leaf') + end end end