Skip to content

Instantly share code, notes, and snippets.

View camiloribeiro's full-sized avatar
🐰
Coding @ Spotify

Camilo Ribeiro camiloribeiro

🐰
Coding @ Spotify
View GitHub Profile
@camiloribeiro
camiloribeiro / capirb.txt
Created October 10, 2012 14:12 — forked from peterkappus/capirb.txt
Capybara in IRB
# copy and paste this into your terminal to start an IRB session and use Capybara's DSL to write tests interactively
# Thanks to Tom Clements
# http://tom-clements.com/blog/2012/02/25/capybara-on-the-command-line-live-browser-testing-from-irb/
irb
require 'capybara/dsl'
include Capybara::DSL
Capybara.default_driver = :selenium
visit "http://127.0.0.1:3000"
visit "http://www.google.com" #etc...
@camiloribeiro
camiloribeiro / gist:920d12e2f90ce3ac01d8f85c80594549
Created December 19, 2016 13:26
follow changes and run tests on mac
fswatch -r -o -e 'pyc' . | (while read; do python *_test.py; done)
@camiloribeiro
camiloribeiro / pipeline_jenkins2.groovy
Last active November 23, 2016 23:17
Example jenkins 2 pipeline
stage 'test'
parallel (
"scenario A": {
node {
echo 'dry run'
}
},
"scenario B": {
node {
echo 'dry run'
@camiloribeiro
camiloribeiro / triangle.feature
Created February 15, 2012 04:17
Simple cucumber example in Portuguese
#language: pt
Funcionalidade: Leitor de tipos de Triângulo
Para conhecer o tipo de um triângulo
Como um aluno da matemática
Eu quero informar os tamanhos do lado de um triângulo e saber qual o tipo do triângulo
NARRATIVA
Um triângulo com todos os lados iguais é chamado Equilátero
@camiloribeiro
camiloribeiro / robot.js
Created December 5, 2012 16:17
QARobot
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.clone();
rspec --require ./watir_html_formatter.rb --format WatirHtmlFormatter --out output/index.html test/bar_spec.spec
require "rspec/core/formatters/base_text_formatter"
class WatirHtmlFormatter < RSpec::Core::Formatters::BaseTextFormatter
end
def extra_failure_content(failure)
content = []
content << "<span>"
file_name = save_html
content << link_for(file_name)
@camiloribeiro
camiloribeiro / get_cpfs.rb
Created October 26, 2012 20:56
Get cpf numbers
require "watir-webdriver"
b = Watir::Browser.new
b.goto "http://www.geradordecpf.org/"
arr = Array.new
5000.times do |i|
b.button(:value => "Gerar").click
arr.push(b.text_field(:id => "numero").value)
@camiloribeiro
camiloribeiro / implicit_wait_working.rb
Created October 3, 2012 05:15
Example of using of implicit wait time for watir-webdriver in a simple ajax form
require "watir-webdriver"
b = Watir::Browser.new
b.goto "http://www.republicavirtual.com.br/cep/exemplos.php"
b.text_field(:id => "campoCEP").value = "<SEU CEP AQUI>"
b.button(:value => "buscar cep").click
puts Watir::Wait.until {b.div(:id => "resultado").text.include? "sucesso"}
@camiloribeiro
camiloribeiro / gist:3753183
Created September 20, 2012 00:18
Reinstall all gems
gem list | cut -d ' ' -f 1 | tee gems.txt | xargs gem uninstall -I -a && for path in $(echo `gem env path` | tr ":" "\n"); do rm -rf ${path}/specifications/* ${path}/cache/*; done && cat gems.txt | xargs gem install
rm gems.txt