내 모델 (비 activerecord)에 초기화 메서드를 작성했습니다. 해당 메서드를 초기화하기 위해 rspec을 작성하려고했지만 어떻게 작성해야할지 모르겠습니다. 도와주세요.rspec 초기화 메서드
은 여기 내 모델
class Sample
ATTRIBUTES = %w{ picture_id owner_id hr_width hr_height thumb_width
thumb_height thumb_url journal is_border lr_url }.map! { |s| s.to_sym }.freeze
attr_accessor *ATTRIBUTES
require 'httpclient'
def initialize(*h)
if h.length == 1 && h.first.kind_of?(Hash)
h.first.each { |k,v| send("#{k}=",v) }
end
end
end
제 답변에도 불구하고 stackoverflow가 그러한 질문에 대한 장소라고 생각하지 않습니다. – bronislav