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!
<?php | |
/** | |
* I18N class for translating text to any language | |
* Uses YAML files | |
* | |
* Usage: I18N::t("user.name") # => "Karl Metum" | |
* In the above example "name" is nested under "user" | |
* | |
* Make sure that the following constants are set in | |
* your configuration file: |
# Copyright (C) [2014] by Keith Tom <keith dot tom at gmail> | |
# Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. | |
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE | |
module Rack | |
# disable CSS3 and jQuery animations in test mode for speed, consistency and avoiding timing issues. | |
# Usage for Rails: | |
# in config/environments/test.rb | |
# config.middleware.use Rack::NoAnimations | |
class NoAnimations |
#!/bin/bash | |
# Add Vagrant's NFS setup commands to sudoers, for `vagrant up` without a password | |
# Updated to work with Vagrant 1.3.x | |
# Stage updated sudoers in a temporary file for syntax checking | |
TMP=$(mktemp -t vagrant_sudoers) | |
cat /etc/sudoers > $TMP | |
cat >> $TMP <<EOF | |
# Allow passwordless startup of Vagrant when using NFS. |
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!
- Tune /etc/ssh/sshd_config | |
UseDNS no # Disable DNS lookups | |
GSSAPIAuthentication no # Disable negotation of slow GSSAPI | |
don't forget to restart it, use a script provider to set it , or create it with veewee or snapshot it | |
- Tune Vagrantfile | |
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] |
module MyApp | |
class Application < Rails::Application | |
require Rails.root + 'lib/custom_public_exceptions' | |
config.exceptions_app = CustomPublicExceptions.new Rails.public_path | |
end | |
end |
<?php | |
$permissions = ACLField::hasAccess($field, $module, $GLOBALS['current_user']->id, $is_owner); | |
switch ( $permissions ) { | |
case 0: | |
echo "No access to this field"; | |
break; | |
case 1: | |
echo "Read-only access to this field"; | |
break; |
<!DOCTYPE html> | |
<head> | |
<title>Stay Standalone</title> | |
<meta name="apple-mobile-web-app-capable" content="yes"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> | |
<script src="stay_standalone.js" type="text/javascript"></script> | |
</head> | |
<body> | |
<ul> | |
<li><a href="http://google.com/">Remote Link (Google)</a></li> |
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |