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
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@adamsanderson
adamsanderson / test_mail_purge.rb
Created December 18, 2010 04:35
An example of using MiniTest::Mock
require 'minitest/mock'
require 'minitest/unit'
require 'date'
MiniTest::Unit.autorun
class TestMailPurge < MiniTest::Unit::TestCase
class MailPurge
def initialize(imap)
@imap = imap
@fnichol
fnichol / README.md
Created March 12, 2011 20:52
Download a cacert.pem for RailsInstaller

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)

@mateusg
mateusg / devise.pt-BR.yml
Last active December 23, 2023 15:15 — forked from alexandreaquiles/devise.pt-BR.yml
pt-BR translations for Devise
# encoding: UTF-8
# pt-BR translations for Devise
pt-BR:
devise:
confirmations:
confirmed: "Sua conta foi confirmada com sucesso. Você está logado."
send_instructions: "Dentro de minutos, você receberá um e-mail com instruções para a confirmação da sua conta."
send_paranoid_instructions: "Se o seu endereço de e-mail estiver cadastrado, você receberá uma mensagem com instruções para confirmação da sua conta."
failure:
already_authenticated: "Você já está logado."
@mateusg
mateusg / inflections.rb
Created April 17, 2011 23:03
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 )
@metaskills
metaskills / wait_until.rb
Last active October 20, 2023 13:08
Never sleep() using Capybara!
# WAIT! Do consider that `wait` may not be needed. This article describes
# that reasoning. Please read it and make informed decisions.
# https://www.varvet.com/blog/why-wait_until-was-removed-from-capybara/
# Have you ever had to sleep() in Capybara-WebKit to wait for AJAX and/or CSS animations?
describe 'Modal' do
should 'display login errors' do
visit root_path
class Carrinho
def initialize
@itens = []
end
def incluir(produto)
@itens << ItemCarrinho.new(produto)
end
def remover(produto)
@rodrigomanhaes
rodrigomanhaes / capitulo1.rst
Created June 17, 2012 17:46
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.

@iros
iros / API.md
Created August 22, 2012 14:42
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

# -*- 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