I have a set of users
And a set of things … podcasts
Users should get a page that shows all of the podcassts with a check box
If they are subscribed then the check box is checked
Users table has first_name, last_name, user_name
Podcats table has podcast_name, description, url
Subscriptions table has user_id, podcast_id, subscription_type
Would the view go in the subscription views?
Is this a index view?
How do I mock out the view?
I think I want to spec something so that I set up three mock models for
podcasts:
before(:each) do
assigns[:user] = @user = stub_model(User,
:new_record? => false,
:user_id => 1,
:first_name => “Fred”,
:last_name => “Flintstone”,
:user_name => “fflintstone”
)
assings[:repository] = @repository = [stub_model(Podcast,
:new_record? => false,
:name => “podcast1”,
:host => “podcast.podcast.com”,
),
stub_model(Podcast,
:new_record? => false,
:name => "podcast2",
:host => "podcast.podcast.com",
),
stub_model(Podcast,
:new_record? => false,
:name => "podcast3",
:host => "podcast.podcast.com",
)
]
assigns[:subscription] = @subscription = [ stub_model(Subscription,
:new_record? => false,
:user_id => 1,
:podcast_id => 1
),
stub_model(Subscription,
:new_record? => false,
:user_id => 1,
:podcast_id => 2
)]
end
then look to make sure that it renders all of the podcasts and the ones
that are subscribed subscribed checkbox is selected:
It “should render the subscriber select form” do
render
now what?
end
Thanks
Brian Colfer