Skip to content

Instantly share code, notes, and snippets.

View luizpicolo's full-sized avatar
👨‍🏫
Teaching

Luiz F. Picolo luizpicolo

👨‍🏫
Teaching
View GitHub Profile
@luizpicolo
luizpicolo / install.sh
Last active September 7, 2016 15:02
Auto Installer
#!/bin/bash
# install zsh
rm -fr .oh-my-zsh/
curl -L http://install.ohmyz.sh > install.sh
sh install.sh
# add final .zshrc
echo 'source ~/.bash_aliases' >> ~/.zshrc
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> >> ~/.zshrc
=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')
#encoding: utf-8
pt-BR:
views:
pagination:
first: "« Primeira"
last: "Última »"
previous: "‹ Anterior"
next: "Próxima ›"
truncate: "…"
@luizpicolo
luizpicolo / gist:dbdff3ce8149798b265b
Created July 28, 2014 01:23
Mina Deploy RollBack
desc "Rolls back the latest release"
task :rollback => :environment do
queue! %[echo "-----> Rolling back to previous release for instance: #{domain}"]
# Delete existing sym link and create a new symlink pointing to the previous release
queue %[echo -n "-----> Creating new symlink from the previous release: "]
queue %[ls "#{deploy_to}/releases" -Art | sort | tail -n 2 | head -n 1]
queue! %[ls -Art "#{deploy_to}/releases" | sort | tail -n 2 | head -n 1 | xargs -I active ln -nfs "#{deploy_to}/releases/active" "#{deploy_to}/current"]
# Remove latest release folder (active release)

Capybara

save_and_open_page

Matchers

have_button(locator)
@luizpicolo
luizpicolo / deploy.rb
Last active August 29, 2015 14:06 — forked from jbonney/deploy.rb
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm' # for rvm support. (http://rvm.io)
# Repository project
set :repository, 'git@bitbucket.org:agencia-w3case/boletinonline.git'
# Server Production
task :production do
@luizpicolo
luizpicolo / install_server.sh
Last active April 8, 2017 22:26
Install Server
# Configure Timezone
dpkg-reconfigure tzdata
# Configure locale
locale-gen pt_BR pt_BR.UTF-8
locale-gen en_US en_US.UTF-8
# Instalar Postgree e trocar senha
sudo apt-get install postgresql postgresql-contrib
psql -c "ALTER USER postgres WITH PASSWORD 'nova_senha'" -d template1
def parent_params
params.require(:parent).permit(
:name, :rg, :cpf, :birth_date, :avatar, {:student_ids => []},
:user_attributes => [:email, :password, :password_confirmation]
)
end
=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')
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)