Skip to content

Instantly share code, notes, and snippets.

View elissonmichael's full-sized avatar
🚫
undefined method 'status' for nil:NilClass

Élisson Michael elissonmichael

🚫
undefined method 'status' for nil:NilClass
View GitHub Profile
@elissonmichael
elissonmichael / markdown.md
Last active December 13, 2019 19:30 — forked from rastasheep/markdown.md
MiniTest quick reference

MiniTest::Spec

use must for positive expectations and wont for negative expectations.

  • must_be | list.size.must_be :zero?
  • must_be_close_to | subject.size.must_be_close_to 1,1
  • must_be_empty | list.must_be_empty
  • must_be_instance_of | list.must_be_instance_of Array
  • must_be_kind_of | list.must_be_kind_of Enumerable
# Sample reference code for doubles/mocks, stubs, and spies in RSpec
# Taken from Kevin Skoglund's RSpec tutorial on Lynda.com
describe 'Doubles' do
it "allows stubbing methods" do
dbl = double("Chant")
allow(dbl).to receive(:hey!)
expect(dbl).to respond_to(:hey!)
end
describe 'Expectation Matchers' do
describe 'equivalence matchers' do
it 'will match loose equality with #eq' do
a = "2 cats"
b = "2 cats"
expect(a).to eq(b)
expect(a).to be == b # synonym for #eq
@elissonmichael
elissonmichael / poodir-notes.md
Created May 30, 2018 15:27 — forked from speric/poodir-notes.md
Notes From "Practical Object-Oriented Design In Ruby" by Sandi Metz

Chapter 1 - Object Oriented Design

The purpose of design is to allow you to do design later, and it's primary goal is to reduce the cost of change.

SOLID Design:

  • Single Responsibility Principle: a class should have only a single responsibility
  • Open-Closed Principle: Software entities should be open for extension, but closed for modification (inherit instead of modifying existing classes).
  • Liskov Substitution: Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.
  • Interface Segregation: Many client-specific interfaces are better than one general-purpose interface.
@elissonmichael
elissonmichael / pt-BR.yml
Created June 17, 2018 22:18 — forked from bmentges/pt-BR.yml
will_paginate translation to portuguese
pt-BR:
will_paginate:
previous_label: "← Anterior"
next_label: "Próximo →"
page_gap: "…"
page_entries_info:
single_page_html:
zero: "Nenhum registro encontrado"
one: "Apenas 1 registro encontrado"
other: "Mostrando todos os %{count} registros encontrados"
# -*- encoding : utf-8 -*-
#
# Rodrigo Soares Manhães, professor homenageado pelos formandos da turma de 2007
# do curso de Ciência da Computação da UENF.
#
# 20/09/2012
#
##
class Aluno < ActiveRecord::Base
@elissonmichael
elissonmichael / capitulo1.rst
Created June 19, 2018 13:07 — forked from rodrigomanhaes/capitulo1.rst
Resumo do livro Agile Estimating and Planning, de Mike Cohn

AGILE ESTIMATING AND PLANNING

Mike Cohn

CHAPTER 1. The Purpose of Planning

Plans help to guide investment decisions (this project is worth to begin?), know who needs to be available to work on a project during a given period and know if a project is on track.

@elissonmichael
elissonmichael / carrinho.rb
Last active June 26, 2018 02:02 — forked from rodrigomanhaes/carrinho.rb
Carrinho de Compras com Mock
class Carrinho
attr_reader :pedidos
def initialize(args)
@pedido_class = args[:pedido_class]
@pedidos = []
end
def adicionar(produto)
@pedidos << @pedido_class.new(produto)
end
@elissonmichael
elissonmichael / inflections.rb
Created August 6, 2018 22:30 — forked from mateusg/inflections.rb
pt-BR inflections file for Ruby on Rails applications
# encoding: utf-8
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
@elissonmichael
elissonmichael / atom-ruby-snippets.cson
Created November 22, 2018 16:39 — forked from yuanyan/atom-ruby-snippets.cson
Ruby Snippets for Atom
'.source.ruby':
'describe (String)':
'prefix': 'des'
'body': 'describe "${1:subject}" do\n $0\nend'
'describe (type)':
'prefix': 'dest'
'body': 'describe ${1:Type} do\n $0\nend'
'describe (type, string)':
'prefix': 'dests'
'body': 'describe ${1:Type}, "${2:description}" do\n $0\nend'