As configured in my dotfiles.
start new:
tmux
start new with session name:
| require 'rubygems' | |
| require 'rack' | |
| class Object | |
| def webapp | |
| class << self | |
| define_method :call do |env| | |
| func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?) | |
| [200, {}, send(func, *attrs)] | |
| end |
| # autoload concerns | |
| module YourApp | |
| class Application < Rails::Application | |
| config.autoload_paths += %W( | |
| #{config.root}/app/controllers/concerns | |
| #{config.root}/app/models/concerns | |
| ) | |
| end | |
| end |
| # A two-line colored Bash prompt (PS1) with Git branch and a line decoration | |
| # which adjusts automatically to the width of the terminal. | |
| # Recognizes and shows Git, SVN and Fossil branch/revision. | |
| # Screenshot: http://img194.imageshack.us/img194/2154/twolineprompt.png | |
| # Michal Kottman, 2012 | |
| RESET="\[\033[0m\]" | |
| RED="\[\033[0;31m\]" | |
| GREEN="\[\033[01;32m\]" | |
| BLUE="\[\033[01;34m\]" |
As configured in my dotfiles.
start new:
tmux
start new with session name:
| #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) |
| # We have to remove validations on email, as it's no longer needed. | |
| # Based on a solution found at http://stackoverflow.com/questions/7545938/how-to-remove-validation-using-instance-eval-clause-in-rails | |
| Model.class_eval do | |
| _validators.reject!{ |key, _| key == :field } | |
| _validate_callbacks.each do |callback| | |
| callback.raw_filter.attributes.delete :field | |
| end |
| #config/initializers/delayed_job_config.rb | |
| if Rails.env.development? | |
| Delayed::Worker.delay_jobs = false | |
| else | |
| {file contents} | |
| end |
| # This is a skeleton for testing models including examples of validations, callbacks, | |
| # scopes, instance & class methods, associations, and more. | |
| # Pick and choose what you want, as all models don't NEED to be tested at this depth. | |
| # | |
| # I'm always eager to hear new tips & suggestions as I'm still new to testing, | |
| # so if you have any, please share! | |
| # | |
| # This skeleton also assumes you're using the following gems: | |
| # | |
| # rspec-rails: https://github.com/rspec/rspec-rails |