Skip to content

Instantly share code, notes, and snippets.

require 'test_helper.rb'
require 'integration/integration_common.rb'
class AdminCategoriesTest < ActionController::IntegrationTest
include ActionView::Helpers::TranslationHelper
include Webrat::HaveTagMatcher
include UkOrgPondIntegrationCommon
include ApplicationHelper
* Invoices table includes an invoice number.
* InvoiceNumbers table is a singleton and contains the 'next' invoice number.
* To generate a new invoice, in a transaction:
- Increment the InvoiceNumbers singleton to get your next number
- Create the invoice and save it with the number contained therein
* Any request to find an invoice number which is not recorded must map to a case where
somehow the InvoiceNumbers increment succeeded but the invoice was not generated and
despite this transaction failure, nothing rolled back. This should never happen, but
if it does, you can state logically that there is no real gap for audit purposes.
* We assume that VAT invoices are not generated very frequently (they're generated by
########################################################################
# File:: without_table.rb
# (C):: http://stackoverflow.com/questions/315850/rails-model-without-database/318919#318919
#
# Purpose:: Define a class which lets us use ActiveRecord validations
# without needing a database representation of the model.
# ----------------------------------------------------------------------
# 23-Mar-2010 (ADH): Created.
########################################################################
SSLRandomSeed startup file:/dev/urandom 512
SSLRandomSeed connect file:/dev/urandom 512
#SSLSessionCache "xxx"
SSLSessionCache "xxx"
SSLSessionCacheTimeout 300
SSLMutex "xxx"
AddType application/x-x509-ca-cert .crt
@pond
pond / remove_duplicates.m
Created February 13, 2011 19:42
Objective C fragment from Add Folder Icons which removes duplicate folders
/******************************************************************************\
* -removeDuplicatesFromIndices:comparedAgainst:
*
* Pass two pointers to NSIndexSet instances. The first describes indices in
* 'tableContents' which are to be searched. The second describes indices in
* 'tableContents' which are to be compared. If any items from the second set
* of indices are found to have a match in the first set of indices, then the
* matching item in the *first set* is deleted.
*
* A 'match' is defined as 'same value for the @"path" key'. Other keys in the
test_99_compare_report_ID_21_with_reference(SavedReportTest):
NoMethodError: undefined method `from' for nil:NilClass
/Users/adh1003/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.14/lib/active_record/relation/query_methods.rb:264:in `build_arel'
/Users/adh1003/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.14/lib/active_record/relation/query_methods.rb:260:in `arel'
/Users/adh1003/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.14/lib/active_record/relation/delegation.rb:29:in `respond_to?'
require File.dirname(__FILE__) + '/../test_helper'
class SavedReportTest < ActiveSupport::TestCase
def not_nil( a, msg )
@errors << [ msg, a ] if a.nil?
end
def check( a, b, msg )
@errors << [ msg, a, b ] unless a == b
pondmac:log adh1003$ rake db:migrate
(in /Users/adh1003/Documents/Work/Hipposoft/TrackRecord/Development/trackrecord)
== CreateHomes: migrating ====================================================
-- create_table(:homes)
NOTICE: CREATE TABLE will create implicit sequence "homes_id_seq" for serial column "homes.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "homes_pkey" for table "homes"
-> 0.0236s
== CreateHomes: migrated (0.0237s) ===========================================
pondmac:log adh1003$ rails c
pondmac:log adh1003$ irb
1.9.3p392 :004 > {:thing => ("foo" if true)}
=> {:thing=>"foo"}
1.9.3p392 :005 > {:thing => ("foo" if false)}
=> {:thing=>nil}
1.9.3p392 :006 >
1.9.3p392 :010 > reference = YAML::load( reference )
NoMethodError: undefined method `from' for nil:NilClass
from /Users/adh1003/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.14/lib/active_record/relation/query_methods.rb:264:in `build_arel'
from /Users/adh1003/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.14/lib/active_record/relation/query_methods.rb:260:in `arel'
from /Users/adh1003/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.14/lib/active_record/relation/delegation.rb:29:in `respond_to?'
from /Users/adh1003/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:291:in `init_with'
from /Users/adh1003/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:284:in `revive'
from /Users/adh1003/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:219:in `visit_Psych_Nodes_Mapping'
from /Users/adh1003/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/psych/visitors/visitor.rb:15:in `visit'
from /Users/adh1003/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1