Forum: RSpec how to test this view with Rspec

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Zhenning G. (Guest)
on 2009-03-14 15:12
= flash_messages
- @user = User.find(1)
- if current_user == @user
  %new_forum= link_to 'new forum', new_forum_path

- @forum.each do |f|
    = link_to, forum_path(f)
    - if current_user == @user
      = link_to 'edit', edit_forum_path(f)
      = link_to 'destroy', forum_path(f), :method => :delete

does anyone have some good example?
Thomas r. K. (Guest)
on 2009-03-14 16:21
(Received via mailing list)
Am 14.03.2009 um 14:12 schrieb Zhenning G.:

> = flash_messages
> - @user = User.find(1)

move that to the controller or a helper. always.
and if you try to find the admin with that, add a flag on the user
so you can write current_user.admin?

 > - @forum.each do |f|
 >   .group
 >     = link_to, forum_path(f)

Am I wrong or shouldn't that read:
- @forums.each do |f|

And do yourself a favour and write forum not f. Otherwise easily
mistaken as a form.

> does anyone have some good example?

About testing. Test with a current_user (e.g.
with an admin and without any user at all.
And of course test with @forums being empty, a special response for
that case would be nice.

ciao, tom

Thomas R. "TomK32" Koll || ||
just a geek trying to change the world
Skype: TomK32 || Mail: removed_email_address@domain.invalid
This topic is locked and can not be replied to.