save_and_open_page
have_button(locator)
postgres: | |
adapter: postgresql | |
database: myapp_test | |
username: postgres | |
before_script: | |
- "psql -c 'create database myapp_test;' -U postgres" | |
- "rake db:migrate" |
fabio@fabio-vbox:~/app_contatos_rails$ git init | |
Initialized empty Git repository in /home/fabio/app_contatos_rails/.git/ | |
fabio@fabio-vbox:~/app_contatos_rails$ git add . | |
fabio@fabio-vbox:~/app_contatos_rails$ git commit -m "Initial commit" | |
[master (root-commit) 76a11c1] Initial commit | |
36 files changed, 1133 insertions(+), 0 deletions(-) | |
create mode 100644 .gitignore | |
create mode 100644 .rvmrc | |
create mode 100644 Gemfile |
=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') |
require "xpath" # XPath is a separate gem now | |
module Cucumber | |
module Rails | |
module CapybaraSelectDatesAndTimes | |
def select_date (date, options = {}) | |
date = Date.parse(date) | |
# lookup id prefix by label | |
id_prefix = id_prefix_for(options[:label]) |
require "capybara" | |
# Encapsulate some jQuery UI interactions so we can call them cleanly using Capybara. | |
module Capybara::JQueryUI | |
# Find the jQuery UI Autocomplete widget corresponding to this element | |
def autocompleter | |
jquery_result(jquery_this(".autocomplete('widget')").first) | |
end | |
# Fill in an autocompletable field and accept a completion. |
module Wysihtml5Helper | |
def fill_in_wysihtml5(text) | |
#js must be enabled | |
page.execute_script("editor.setValue('#{text}')") | |
end | |
end |
module Wysihtml5Helper | |
def fill_in_html name, options | |
options.to_options!.assert_valid_keys :with | |
if Capybara.current_driver == Capybara.javascript_driver | |
# Dip inside capybara session to respect current `within` scope | |
scope = page.send(:current_node).path | |
# Find the textarea based on label name within the given scope | |
query = "$('label:contains(#{name.inspect}) ~ textarea:eq(0)', document.evaluate(#{scope.inspect}, document).iterateNext())" | |
# Make sure the editor is instantiated -- this is us, not wysihtml5 | |
wait_until { page.evaluate_script("!!#{query}.data('editor')") } |
#!/bin/bash | |
# | |
# PostgreSQL Backup Script Ver 1.0 | |
# http://autopgsqlbackup.frozenpc.net | |
# Copyright (c) 2005 Aaron Axelsen <[email protected]> | |
# | |
# This script is based of the AutoMySQLBackup Script Ver 2.2 | |
# It can be found at http://sourceforge.net/projects/automysqlbackup/ | |
# | |
# The PostgreSQL changes are based on a patch agaisnt AutoMySQLBackup 1.9 |
############################## | |
class Cart < ActiveRecord::Base | |
has_many :line_items, :dependent => :destroy | |
end | |
class Post < ActiveRecord::Base | |
has_many :line_items | |
end | |
class LineItem < ActiveRecord::Base |