assigns(:message).should eq(@message)
assign(:message, stub("Message", :text => "Hello world!"))
Hmm, so 'assign' to assign a variable and 'assigns' to read an
assigned variable?
We need to update the RSpec 2 wiki or somewhere with all these API
changes so it is clear to everyone.
On Jun 11, 9:08 am, David Chelimsky <[email protected]> wrote:
> On Thu, Jun 10, 2010 at 4:41 PM, <[email protected]> wrote:
> > I might be missing something basic here, but I'm stumped on this
> > error:
>
> > model code:
>
> > 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
>
> > spec code:
>
> > 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
>
> > The error is: undefined local variable or method `assigns' for
> > #<Spec::Rails::Example::ModelExampleGroup::Subclass_1:0x2fbac28>
>
> > I feel like I'm overlooking something obvious but it's invisible to
> > me. Any suggestions?
>
> assigns is for controller and view specs, not model specs. What is it
> you're trying to specify here?
> _______________________________________________
> rspec-users mailing list
> [email protected]http://rubyforge.org/mailman/listinfo/rspec-users
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users