Skip to content

Instantly share code, notes, and snippets.

@patmaddox
Created June 1, 2009 18:55
Show Gist options
  • Select an option

  • Save patmaddox/121652 to your computer and use it in GitHub Desktop.

Select an option

Save patmaddox/121652 to your computer and use it in GitHub Desktop.
describe Agency do
before(:each) do
puts "in before(:each)"
end
after(:each) do
puts "in after(:each)"
end
before(:all) do
puts "in evil before(:all)"
end
it "should be awesome" do
1.should == 1
end
it "should be really cool" do
2.should == 2
end
end
describe Agency do
before(:each) do
puts "in before(:each)"
end
before(:all) do
puts "in evil before(:all)"
end
it "should be really cool" do
2.should == 2
end
describe "a nested context" do
it "should do something" do
3.should == 3
end
end
end
class << ActiveRecord::Base.connection
[:begin, :commit, :rollback].each do |action|
define_method("#{action}_db_transaction_with_logging") do
puts "#{action} transaction"
send "#{action}_db_transaction_without_logging"
end
alias_method_chain "#{action}_db_transaction", :logging
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment