Skip to content

Instantly share code, notes, and snippets.

  • Por que fazer testes?
    • saber se o software está funcionando de maneira automatizada
      • não elimina os testes exploratórios feito de forma manual
    • manter custos de desenvolvimento em níveis saudáveis
    • ajuda na qualidade interna do código (design e arquitetura do código)
  • Como avaliar a qualidade dos testes (se estão bem feitos)?
    • corretude - se o teste não está gerando um falso positivo
  • adequação do tipo de teste - se o teste é o mais adequado para a situação
@elainenaomi
elainenaomi / time_vs_datatime.md
Created March 27, 2018 14:02 — forked from pixeltrix/time_vs_datatime.md
When should you use DateTime and when should you use Time?

When should you use DateTime and when should you use Time?

It's a common misconception that [William Shakespeare][1] and [Miguel de Cervantes][2] died on the same day in history - so much so that UNESCO named April 23 as [World Book Day because of this fact][3]. However because England hadn't yet adopted [Gregorian Calendar Reform][4] (and wouldn't until [1752][5]) their deaths are actually 10 days apart. Since Ruby's Time class implements a [proleptic Gregorian calendar][6] and has no concept of calendar reform then there's no way to express this. This is where DateTime steps in:

>> shakespeare = DateTime.iso8601('1616-04-23', Date::ENGLAND)
=> Tue, 23 Apr 1616 00:00:00 +0000
>> cervantes = DateTime.iso8601('1616-04-23', Date::ITALY)
=> Sat, 23 Apr 1616 00:00:00 +0000
Sidekiq.redis { |conn| conn.flushdb } # clear everything
Sidekiq::Queue.all # get all queues
Sidekiq::Queue.new # get the "default" queue
Sidekiq::Queue.new("mailer") # get the "mailer" queue
Sidekiq::Queue.new.clear # deletes all jobs in a queue, by removing the queue
Sidekiq::Queue.all.each(&:clear) # deletes all jobs in all queues
ss = Sidekiq::ScheduledSet.new
ss.size
@elainenaomi
elainenaomi / Ruby_Rails_Naming_Conventions.md
Created December 28, 2017 01:53 — forked from alexpchin/Ruby_Rails_Naming_Conventions.md
Ruby & Rails Naming Conventions

Alex's Rails Cheat Sheet

I think the most confusing thing that I have found about Ruby on Rails so far has been the transition from (trying to) write code myself to the use of the fabled "Rails Magic". So, to help my own understanding of a few core Ruby on Rails concepts, I have decided to write something on what I think is a CRITICAL topic... the idea of Convention over Configuration and why (in my mind) it is the most important thing that helps Rails become magic!

(This may be a topic that we cover in more detail in class but as I said, I'm writing this for my own understanding... I hope it helps someone else understand things too... Perhaps you can give me a hand when I'm crying next week!)

##Convention over configuration ###What does this "actually" mean...