Tigraine
Tigraine

Reputation: 23648

All fixtures in rails

I guess I am missing something very very obvious, but in my RSpec tests I want to do something like this:

it "should assign all channels to @channels" do                                                                                                                                                                      
  get :index                                                                                                                                                                                         
  assigns(:channels).should eq(channels(:all))                                                                                                                                                       
end

As you can see I want all channels in an array for my tests so I don't have to fix all my tests when I add a new fixture in the future.

channels(:all) is not working and channels.kind_of? Array is true and empty by default.

Any suggestions?

Upvotes: 1

Views: 491

Answers (1)

oldhomemovie
oldhomemovie

Reputation: 15129

What you might need is:

assigns(:channels).should eq(Channel.all)

Upvotes: 4

Related Questions