functional tests - setup and teardown

Hi all,

functional test help please,

http://pastie.org/1049300

lines 5 to 8 simulate a login; all fine, but after line 56 I'd like to
test the reverse that everything is blocked when the user is not logged
in. So the question is how could I not do that setup routine after line
56, or is there a better way ?

Hi all,

functional test help please,

http://pastie.org/1049300

lines 5 to 8 simulate a login; all fine, but after line 56 I'd like to
test the reverse that everything is blocked when the user is not logged
in. So the question is how could I not do that setup routine after line
56, or is there a better way ?

You could just have two separate test files, or you might want to look
at shoulda

Fred

Is my approach a reasonable way to go? I only ask as it's a problem I've
come up against a few times (how to login in tests) - whether it's via
authlogic or basic http auth as in this case. Realising that I can add
other methods to test_helper.rb that could help me out in a similar way!

bingo bob wrote:

Hi all,

functional test help please,

http://pastie.org/1049300

lines 5 to 8 simulate a login; all fine, but after line 56 I'd like to
test the reverse that everything is blocked when the user is not logged
in. So the question is how could I not do that setup routine after line
56, or is there a better way ?

There is a better way: use Cucumber. Functional tests basically suck.

Best,

why?

bingo bob wrote:

why?

Why what? Please quote when replying so we know what you're replying
to.

Best,