autocmd BufWritePre * :%s/\s\+$//e
(add-hook 'before-save-hook 'delete-trailing-whitespace)
# Then in your features you'll only need to call the `login_as` or `logout` | |
# methods. More info here: http://wiki.github.com/hassox/warden/testing | |
feature "Home page" do | |
background do | |
@user = User.create(...) # Or use fixtures, factories or whatever, even a | |
# stub user | |
login_as @user | |
visit home_page |
if __FILE__ == $0 | |
puts "Run with: watchr #{__FILE__}. \n\nRequired gems: watchr rev" | |
exit 1 | |
end | |
# -------------------------------------------------- | |
# Convenience Methods | |
# -------------------------------------------------- | |
def run(cmd) | |
puts(cmd) |
if __FILE__ == $0 | |
puts "Run with: watchr #{__FILE__}. \n\nRequired gems: watchr rev" | |
exit 1 | |
end | |
# -------------------------------------------------- | |
# Convenience Methods | |
# -------------------------------------------------- | |
def run(cmd) | |
puts(cmd) |
# env.rb | |
Capybara.register_driver :selenium do |app| | |
Capybara::Selenium::Driver.new(app, :browser => :chrome) | |
end | |
Download chromedriver from http://code.google.com/p/selenium/downloads/list | |
mv chromedriver to /usr/local/bin so it's in your path. |
# put this in spec_helper.rb | |
module Kernel | |
private | |
def xdescribe(*args, &blk) | |
describe *args do | |
pending "xxxxxxxxx" | |
end | |
end |
Below are steps I followed to get ruby debugger ruby-debug
running with Pow. Based on info from this thread basecamp/pow#43 and this blog post http://flochip.com/2011/04/13/running-pow-with-rdebug/
Assuming you're writing your app in Ruby 1.9 and using Bundler, just add the dependency to your development gems:
#!/bin/bash -e | |
# | |
# Since unicorn creates a new pid on restart/reload, it needs a little extra love to | |
# manage with runit. Instead of managing unicorn directly, we simply trap signal calls | |
# to the service and redirect them to unicorn directly. | |
# | |
# To make this work properly with RVM, you should create a wrapper for the app's gemset unicorn. | |
# | |
function is_unicorn_alive { |
# include at least one source and the rails gem | |
source :gemcutter | |
gem 'rails', '~> 2.3.5', :require => nil | |
group :development do | |
# bundler requires these gems in development | |
gem 'rails-footnotes' | |
end | |
group :test do |
Having a buckload of code to authorize users on your application is something you may like or not.
Speaking for myself I hate it. But I still love rails_admin
, here's how you install it without devise. Thanks to phoet for providing the hints in the gist I have forked from.
do NOT add devise
gem "rails_admin", :git => "git://github.com/sferik/rails_admin.git"