Skip to content

Instantly share code, notes, and snippets.

@tjjjwxzq
tjjjwxzq / rspec_rails_cheetsheet.rb
Created May 6, 2016 03:42 — forked from them0nk/rspec_rails_cheetsheet.rb
Rspec Rails cheatsheet (include capybara matchers)
#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)
@tjjjwxzq
tjjjwxzq / Rails-notes.md
Last active May 16, 2016 02:42
Ruby on Rails notes

Rails Notes

Setup

Set up rbenv

$ cd
$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc'
$ ~/.rbenv/bin/rbenv init
  • Dynamic Dispatch
  • Dynamic Method
  • Ghost Methods
  • Dynamic Proxies
  • Blank Slate
  • Kernel Method
  • Flattening the Scope (aka Nested Lexical Scopes)
  • Context Probe
  • Class Eval (not really a 'spell' more just a demonstration of its usage)
  • Class Macros
@tjjjwxzq
tjjjwxzq / vimrc
Created March 15, 2017 03:21 — forked from romainl/deprecation.md
Idiomatic vimrc
" Keeping your lovely 'vimrc' INSIDE of your 'vim' directory is a good idea,
" if only because it makes it easier to move your config around.
" If you are using 7.4 exclusively, the following will be enough:
"
" on Unix-like systems ~/.vim/vimrc
" on Windows %userprofile%\vimfiles\vimrc
" If you use both 7.4 and an older version, or only an older version,
" the simplest, future-proof, solution is to put this line and only