Skip to content

Instantly share code, notes, and snippets.

View dubilla's full-sized avatar

Dan Ubilla dubilla

View GitHub Profile
@dubilla
dubilla / gist:c111f2fd832236e33d45
Created January 2, 2016 18:29 — forked from datwright/gist:1082717
Rails Migrations Cheat sheet
# Migration generator shortcuts.
# rails generate migration MyNewMigration
# rails generate migration add_fieldname_to_tablename fieldname:string
# rails generate model Product name:string description:text
# The set of available column types [:string, :text, :integer, :float, :decimal, :datetime, :timestamp, :time, :date, :binary, :boolean]
# A migration is a subclass of ActiveRecord::Migration. You must implement the "up" and "down" (revert) methods.
# These are the handy methods available to a Migration:
@dubilla
dubilla / vim-on-heroku.sh
Created October 8, 2015 19:09 — forked from sfate/vim-on-heroku.sh
vim on heroku
#!/usr/bin/env bash
curl https://s3.amazonaws.com/heroku-jvm-buildpack-vi/vim-7.3.tar.gz --output vim.tar.gz
mkdir vim && tar xzvf vim.tar.gz -C vim
export PATH=$PATH:/app/vim/bin
# Typically in Rails to use VCR we setup the RSpec config like so:
RSpec.configure do |config|
config.extend VCR::RSpec::Macros #deprecated
end
# This gives us access to the use_vcr_cassette method:
describe Reviewed::Article do
use_vcr_cassette 'article/grill'
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')