Skip to content

Instantly share code, notes, and snippets.

View adkron's full-sized avatar

Amos King adkron

View GitHub Profile
Factory.define(:rate_profile) do |rp|
rp.start_date(Date.today)
end
Factory.define(:rate) do |r|
r.value '120.00'
r.rate_profile { Factory :rate_profile }
end
def cascade_taskrefnos
child_tasks = Task.find_all_by_parentid(self.id)
child_tasks.each do |child_task|
child_task.update_attributes! :taskrefno => "#{taskrefno}.#{child_task.childseq}"
child_task.cascade_taskrefnos
end
end
# tokens/termials
EQ
LBRACE
RBRACE
LPAREN
RPAREN
DOT
COMMA
PIPE
#Other stuff, mostly comments
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.1.3/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.1.3
PassengerRuby /usr/bin/ruby1.8
# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/
NameVirtualHost *:80
ServerRoot "/etc/apache2"
LockFile /var/lock/apache2/accept.lock
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
# Don't load rspec if running "rake gems:*"
unless ARGV.any? {|a| a =~ /^gems/}
begin
require 'spec/rake/spectask'
rescue MissingSourceFile
module Spec
module Rake
config.cache_classes = true
config.whiny_nils = true
config.action_controller.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.action_view.cache_template_loading = true
config.action_controller.allow_forgery_protection = false
fork {system 'echo "startup.sh"'}
# RSpec
require 'spec/expectations'
require 'webrat/selenium'
Webrat.configure do |config|
config.mode = :selenium
config.application_address = 'localhost'
config.application_port = 8080
testRegistrationIsValidRunsAllValidationsWhenCallingIsValid: function() {with(this) {
callCountOne = 0;
callCountTwo = 0;
var mockFunOne = function() { callCountOne++; console.log(callCountOne); };
console.log(callCountOne.toString() + 'a');
var mockFunTwo = function() { this.callCountTwo++; };
testObject.registerValidation(mockFunOne, this);
testObject.registerValidation(mockFunTwo, this);
class BackgroundChanger
def initialize(app)
@app = app
end
def call(env)
status, headers, response = @app.call(env)
response.body.gsub!('<body',"<body background='/images/common/bg-staging.gif'") if env['RAILS_ENV'] != 'production' && response.respond_to?(:body) && response.body.respond_to?(:gsub!)
[status, headers, response]
end