Skip to content

Instantly share code, notes, and snippets.

View ajsharp's full-sized avatar

Alex Sharp ajsharp

View GitHub Profile
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Test Page</title>
<script type="text/javascript" src="js/prototype-1.6.0.3.js"></script>
<script type="text/javascript" src="js/livepipe/livepipe.js"></script>
<script type="text/javascript" src="js/livepipe/window.js"></script>
<script type="text/javascript">
def make_friends(user, target)
transaction do
begin
Friend.find(:first, :conditions => {:inviter_id => user.id, :invited_id => target.id, :status => PENDING}).update_attribute(:status, ACCEPTED)
Friend.create!(:inviter_id => target.id, :invited_id => user.id, :status => ACCEPTED)
rescue Exception
return make_friends( target, user) if user.followed_by? target
return add_follower(user, target)
end
end
include AASM
include AASM::Persistence
aasm_column :status
aasm_initial_state Proc.new { |task| task.assignments.empty? ? :not_started }
aasm_state :not_started
aasm_state :in_progress
aasm_state :completed
aasm_event :start_task do
require "autotest/growl"
require "autotest/fsevent"
require 'autotest/restart'
Autotest.add_hook :initialize do |at|
at.unit_diff = 'cat'
end
Autotest.add_hook :ran_command do |at|
Task.find(:all, :include => [{:assignments => :task}], :conditions => ["assignments.assignee_id = ? AND assignments.status = ?", u.id, "accepted"])
# visit.rb
Factory.define :visit do |f|
f.patient { |a| a.association(:patient) }
f.clinic { |a| a.association(:clinic) }
end
# patient.rb
# Defines a new sequence
Factory.sequence :email do |n|
"person#{n}@example.com"
require File.join(File.dirname(__FILE__), "/load-diff-lcs")
require 'pp'
module Spec
module Expectations
module Differs
unless defined?(Default)
class Default
def initialize(options)
@options = options
module Spec
module Expectations
module Differs
unless defined?(Spec::Expecations::Differs::Default)
class Default
require 'rubygems'
require 'spork'
Spork.prefork do
# Loading more in this block will cause your tests to run faster. However,
# if you change any configuration or code from libraries loaded here, you'll
# need to restart spork for it take effect.
ENV["RAILS_ENV"] ||= 'test'
require File.dirname(__FILE__) + "/../config/environment"
--colour
--format progress
--loadby mtime
--reverse
--drb