Skip to content

Instantly share code, notes, and snippets.

Avatar

Amos King adkron

View GitHub Profile
View gist:31683
require File.dirname(__FILE__) + '/../test_helper'
class LoggedInControllerExtensionTest < ActiveSupport::TestCase
def setup
self.expects(:before_filter).with(:foo)
self.include LoggedInControllerExtension
end
def test
View gist:31686
require 'cgi'
module LoggedInControllerExtension
def self.included(base)
base.extend Setup
base.setup_logged_in
end
module Setup
def setup_logged_in
View people_integration_test.rb
require 'test_helper'
class PeopleIntegrationTest < ActionController::IntegrationTest
use_transactional_fixtures = false
context "context no records" do
setup do
Person.create!(:name => 'Mike Gaffney')
visit(people_path)
click_link("Create New")
View my_test_helper.rb
Webrat.configure do |config|
config.mode = :rails
end
View factory_girl_idea.rb
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
View bad_partial_updates.rb
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
View gist:84319
# tokens/termials
EQ
LBRACE
RBRACE
LPAREN
RPAREN
DOT
COMMA
PIPE
View apache2.conf
#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
View apache2.conf
ServerRoot "/etc/apache2"
LockFile /var/lock/apache2/accept.lock
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
View test.rb
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