【发布时间】:2010-06-10 23:10:13
【问题描述】:
我可能在这里遗漏了一些基本的东西,但我被这个错误难住了:
型号代码:
class CachedStat < ActiveRecord::Base
def self.create_stats_days_ago(days_ago, human_id)
d = Date.today - days_ago.day
@prs = PageRequest.find(:all, :conditions => [ "owner_type = 'Human' and owner_id = ? and created_at = ?", human_id, d] )
end
end
规格代码:
it "should create stats for the specified number of days in the past" do
CachedStat.create_stats_days_ago(1, Human.first.id)
assigns[:prs].should eql("foo")
end
错误是:
undefined local variable or method `assigns' for #<Spec::Rails::Example::ModelExampleGroup::Subclass_1:0x2fbac28>
我觉得我忽略了一些明显的东西,但它对我来说是不可见的。有什么建议吗?
非常感谢! -杰森
【问题讨论】:
标签: ruby-on-rails rspec