Skip to content

Instantly share code, notes, and snippets.

@takuyan
Created April 25, 2011 10:06
Show Gist options
  • Save takuyan/940331 to your computer and use it in GitHub Desktop.
Save takuyan/940331 to your computer and use it in GitHub Desktop.
parent method ch
class MyClass
after_create :check_parent
def check_parent
self.parent.do_something
end
end
# spec
require 'spec_helper'
describe MyClass do
before(:each) do
parent = mock_model("Parent")
parent.stub(:do_something)
@my_class = MyClass.new
@my_class.parent = parent
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment