> If something in the code you are testing depends on the return value > of a method then you would use a stub. e.g.: Right, but what I am asking is--- if all of my "slave methods" are relying on stored card data from the @card instance variable-- how is the best way to have access to the variable if it's only defined in the master method?
if I have a method that does @card.addresses.each do |address| ... end and I want to test that a contact does in fact get a new address created after that method is called with a vcard that has a valid address. I mean, one way to do this would be the getter/setter way-- have a card=/card method.. Another way would be to just pass card into each method def process_addresses(card) card.addresses.each... .. But then I start feeling like my code is going to be less-elegant due to the fact that I am trying to write things that can be tested. Passing in a variable is definitely less elegant than using an instance variable, and a getter/setter is somewhat too (in my opinion). Patrick J. Collins http://collinatorstudios.com _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users