This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(100..999).each do |x| | |
(100..999).each do |y| | |
(100..999).each do |z| | |
soma = x + y + z | |
condicao1 = soma.digits.size == 3 | |
condicao2 = soma.digits.uniq.size == 1 | |
n = soma.digits.uniq.first | |
condicao3 = n == x.digits.first && n == y.digits.first && n == z.digits.first | |
condicao4 = x.digits.last == y.digits.last && y.digits.last == z.digits.last | |
condicao5 = x.digits[1] == y.digits[1] && y.digits[1] == z.digits[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'.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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Carrinho | |
attr_reader :pedidos | |
def initialize(args) | |
@pedido_class = args[:pedido_class] | |
@pedidos = [] | |
end | |
def adicionar(produto) | |
@pedidos << @pedido_class.new(produto) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
NewerOlder