added spec coverage for if else pattern