My method:
def swap (order) order = order == 'asc' ? 'desc' : 'asc' end
Spec:
let(:order) { 'wrong_order'} it 'swaps the order' do expect(swap(order)).to eq('asc') end
This rspec does not work with the message ArgumentError: bad value for range
But if I pass "desc" or "asc" and change the wait, it will work fine.
I also tried this on irb, just passing swap (''), it gives me "asc" not sure why rspec is not working
source share