我想使用MiniTest将params移交给构造函数,但我不知道该怎么做。
# model
class Avator
attr_accessor :image, nickname, age
def initialize(image, nickname, age)
self.image = image
self.nickname = nickname
self.age = age
end
end
# test
class ItemImageTest < ActiveSupport::TestCase
def setup
end
end
答案 0 :(得分:1)
你的意思是什么?
class ItemImageTest < ActiveSupport::TestCase
def setup
@avator = Avator.new('image', 'Foo', 15)
end
end