I have the following method:
class Topic
def create_or_rename_folder
unless self.destroyed?
bucket = CreateTopicFolder.new(bucket_name)
bucket.create_or_rename_folder(permalink.split("/").last)
end
end
...
which is called like: after_save :create_or_rename_folder, :if => :production_env?
I would like to test that upon creating a new Topic a new CreateTopicFolder instance gets created, and also that if a Topic is being destroyed, a new instance of CreateTopicFolder is not being created.
That class looks something like:
class CreateTopicFolder
def initialize(bucket_name)
s3 = AutoVideoAssociate
s3.connect
@bucket = s3.find_bucket(bucket_name)
end
...
What is the right way to go about testing this?
Thanks!
1 Answer