I've always liked using the Page Object pattern to write concise, namespaced, and composeable capybara helpers:
When /^I register as a new user$/ do
NewUserPage.new(self).tap do |page|
page.visit!
page.form.fill
page.form.submit!
alias pclean="([ -f Makefile ] || perl Makefile.PL); make realclean && rm -f MANIFEST" | |
alias pinst="perl Makefile.PL INSTALLDIRS=vendor && make && make install && pclean" | |
alias pprepare="rm -rf inc MANIFEST && perl Makefile.PL && make manifest && perl Makefile.PL && make" | |
alias pdist="pprepare && make dist" | |
alias pupload="pprepare && make upload" |
class PdfMerger | |
def merge(pdf_paths, destination) | |
first_pdf_path = pdf_paths.delete_at(0) | |
Prawn::Document.generate(destination, :template => first_pdf_path) do |pdf| | |
pdf_paths.each do |pdf_path| | |
pdf.go_to_page(pdf.page_count) |
I've always liked using the Page Object pattern to write concise, namespaced, and composeable capybara helpers:
When /^I register as a new user$/ do
NewUserPage.new(self).tap do |page|
page.visit!
page.form.fill
page.form.submit!
NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths
Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.
# it's all part of ruby! | |
require 'ostruct' | |
require 'delegate' | |
require 'forwardable' | |
require 'minitest/autorun' # can run rspec style tests with this, part of ruby | |
# --------------------------------------------------------------------------------------------------------- | |
# the classes | |
# using simple delegator with the country object /after/ this app has been made with bad dependency mgmt. | |
# we swap the country string 'FIN' out for a country object with Country.new('FIN') |