Posted: November 25th, 2009 | Author: tarsolya | Filed under: News | Tags: callbacks, factories, shoulda, tdd, testing | 1 Comment »
I’ve been mainly using Shoulda for testing with Test::Unit and Factory Girl helps a lot by letting me stub out simple or more complex object instance variations easily. Now is getting even more easier: callbacks are here!
The three main factory methods all get their respective callbacks, namely: after_build, after_create and after_stub. We can do the following now:
class Foo < ActiveRecord::Base
has_many :bar
end
class Bar < ActiveRecord::Base
belongs_to :foo
end
Factory.define(:foo) do |foo|
foo.title { "The quick brown fox." }
end
Factory.define(:bar) do |bar|
bar.title { "Jumps over the lazy dog." }
end
Factory.define(:foo_with_bar, :parent => :foo) do |foo|
foo.after_create { |o| Factory(:bar, :foo => o) }
end
Neat stuff. 1.2.3 is on Gemcutter now and you can check out more details over at Smashing Robots.
Posted: November 21st, 2009 | Author: tarsolya | Filed under: News | Tags: internals, meta, ruby, tutorial, yehuda | No Comments »
Yehuda Katz written an interesting piece about the nuances of metaprogramming in Ruby. He talks about classes, metaclasses and the importance of self, in particular.
A must read, if you are somewhat familiar, but not totally friends with the OO internals of Ruby.
Posted: November 16th, 2009 | Author: tarsolya | Filed under: News | Tags: javascript, tutorial | No Comments »
John Resig, a well-known javascript hacker, author of the jQuery javascript libarary posted an interesting piece of javascript tutorial, which will guide you through the more confusing inner mechanics of JS with a do-it-yourself approach.
It comes with various easy and more tricky quizes and it’s an introduction of his javascript book, Secrets of the Javascript Ninja. Cool stuff.
(Via ejohn.com.)
Posted: October 20th, 2009 | Author: tarsolya | Filed under: News | Tags: welcome, xpn | No Comments »
Well, it’s been a time since I blogged seriously about tech stuff and since I’m working on to get my small dev shop up and running, it’s time to start again.
You will find stuff here about our projects, the modern web and tools to make it happen: ruby, javascript, rails, php, unix, just to mention a few.
Welcome!