2018-05-01


Been Done

  • Work: 8 hours
    • Resolve Popshop issue: throw 500 when there's no image for a product
  • Pairing Learning:
    • Stub vs Mock(Behavior-based vs State based.)

Thoughts

Pay attention on stack trace

when I pairing with Leander, I found I was not that pay attention on stack track which makes it hard for me to target on errors and I found that Leander is really focused on what been shown on stack trace and it easier for him to target that error, I need to try doing that as well.

Smile no matter what

When I felt stress and when I talking something serious, I will not smile and turn my serious/anger face in front of people which I can see it make the overall atmosphere bad. I need to practice smile and remember smile no matter what the situations are.


Learned

Git

  • made patch and apply patch

git diff head -p >> patch.diff #when code is staged
git apply ***.patch (git apply -h for more details)

Rails

  • how to assign url to asset image

ApplicationController.helper.asset_url

  • Safe Navigation Operator

// find out if the first is null.if it is shows nothing.
product.product_images.first&.url

*  the benefit to Safe Navigation Operator in ruby
  * if product.product_images == nil. it would get => nil
  * if prodcut.prodcut_images doesn't have first method, it would throw an error instead. which is safer
* Also if use hash fetch, use Hash#dig instead
  > address = param[:account].fetch(:owner).fetch(:address)
  > = 
  > address = account.dig(:account, :owner, address)

get Port info from Mac

lsof -i tcp:3000

Stub vs Mock

Mock is what we are talking about here: object pre-programmed with expectations which form a specification of the calls they are expected to receive
stub provide canned answers to calls made during the test, usually not responding at all to anything outside what's programmed in for the test
stub verify state while mock verify behaviors

你可能感兴趣的:(2018-05-01)