Topic: How would you test this behavior with Rspec + Cucmber?
I'm not new to rails but have never before done TDD or BDD. With this project I am determined to learn. I've read the RSpec book as well as plenty of stuff online.
I'm working with post creation and redirection. When logged out and visiting new post, it should go to the login page, and after login go back to the create post page. However, this should not be the case with all pages -- using Devise there is a default user path, so for example you might log in on the index page and once logged in arrive on your profile page. So I want flexibility in where it ends up, and I want to be sure to cover the case where the session is not cleared properly, resulting in a login from the index page taking you to the new post page - bad!
A unit test for controllers doesn't make a whole lot of set -- as it would require testing the session arbitrarily rather than the behavior of the method.
I can't think of a good way with cucumber. The most basic test would require being logged out, logging in at one particular place, logging out, going to another place, logging in, and verifying that the new page was not some particular place. I suppose it would work, but it seems a bit contrived -- something only written after the bug shows up once. I would not originally think to write it.