This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Example Vim configuration. | |
" Copy or symlink to ~/.vimrc or ~/_vimrc. | |
set nocompatible " Must come first because it changes other options. | |
filetype off | |
call pathogen#helptags() | |
call pathogen#runtime_append_all_bundles() | |
"silent! call pathogen#runtime_append_all_bundles() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GEM | |
remote: https://rubygems.org/ | |
specs: | |
actionmailer (3.2.1) | |
actionpack (= 3.2.1) | |
mail (~> 2.4.0) | |
actionpack (3.2.1) | |
activemodel (= 3.2.1) | |
activesupport (= 3.2.1) | |
builder (~> 3.0.0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module UtilitySteps | |
def wait_for_page_load | |
page.wait_until do | |
if Capybara.current_driver != :rack_test | |
page.has_css?('body.dom-loaded') and !has_pending_ajax_request? | |
else | |
true | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.expand_path('../boot', __FILE__) | |
# Pick the frameworks you want: | |
require "active_record/railtie" | |
require "action_controller/railtie" | |
require "action_mailer/railtie" | |
require "active_resource/railtie" | |
require "sprockets/railtie" | |
# require "rails/test_unit/railtie" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/async_smtp_delivery_method.rb | |
require 'mail' | |
class AsyncSmtpDeliveryMethod | |
def initialize(settings) | |
@settings = settings | |
end | |
def deliver!(mail) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module HasSymbolicField | |
extend ActiveSupport::Concern | |
module ClassMethods | |
# Defining (all below are equivalent): | |
# - has_symbolic_field :status, [:active, :pending] | |
# - has_symbolic_field :status, :active => 'Active', :pending => 'Pending' | |
# - has_symbolic_field :status, :active => 'Active', :pending => nil | |
# Accessing: | |
# - it.status # :available |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'nokogiri' | |
require 'fileutils' | |
require 'date' | |
require 'uri' | |
# usage: ruby import.rb my-blog.xml | |
# my-blog.xml is a file from Settings -> Basic -> Export in blogger. | |
data = File.read ARGV[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'capybara/util/timeout' | |
# Rewriting the https://github.com/jnicklas/capybara/blob/master/lib/capybara/util/timeout.rb | |
# Instead of raising timeout error, print the response info | |
module Capybara | |
class << self | |
## | |
# Provides timeout similar to standard library Timeout, but avoids threads |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/tasks/ci.rake | |
require 'nokogiri' | |
desc "Run everything on the CI server with all its outcomes (deploy etc)" | |
task :ci do | |
Rake::Task['spec'].invoke | |
ensure_test_coverage 99 | |
Rake::Task['cucumber'].invoke | |
# TODO: Figure out how to run Jasminerice https://github.com/bradphelan/jasminerice/issues/31 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ENV["RAILS_ENV"] ||= 'test' | |
cur_dir = File.expand_path(File.dirname(__FILE__) + '/..') | |
$LOAD_PATH << "#{cur_dir}" | |
if defined? Bundler | |
# Most likely going with the full env | |
require 'spec_helper' | |
else | |
$LOAD_PATH << "#{cur_dir}/app/models" |