Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Bugs - What are they good for

Bugs - What are they good for

Leif Gensert

December 05, 2019
Tweet

More Decks by Leif Gensert

Other Decks in Technology

Transcript

  1. context 'accepted order' do let(:order) { build(:order, status: 'accepted') }

    it 'returns "closed won"' do expect(deal_stage(order)).to eq('closed won') end end context 'paid order' do let(:order) { build(:order, status: 'paid') } it 'returns "closed won"' do expect(deal_stage(order)).to eq('closed won') end end
  2. def deal_stage(order) return 'enquired' if order.nil? return 'quoted' if order.open?

    return 'closed won' if order.accepted? 'closed lost' end
  3. def deal_stage(order) puts "What's happening?: #{order.inspect}" return 'enquired' if order.nil?

    puts "What's happening?: #{order.inspect}" return 'quoted' if order.open? puts "What's happening?: #{order.inspect}" return 'closed won' if order.accepted? puts "What's happening?: #{order.inspect}" 'closed lost' end Puts Debugging
  4. github.com/pry/pry def deal_stage(order) binding.pry return 'enquired' if order.nil? return 'quoted'

    if order.open? return 'closed won' if order.accepted? 'closed lost' end