Tom Ten Thij
2009-Mar-20 10:59 UTC
[rspec-users] [cucumber] Creating an item without worrying about validity?
In order to check at the cucumber level if permissions are working correctly I am trying to write a cucumber scenario that tests if a logged in user can create a certain model. The step I am trying to implement is ''When I post valid attributes of a frooble''. What I have been trying to do is build a frooble using a factory and doing a post using it attributes. This makes me run into the same issue as http://www.ruby-forum.com/topic/167579. The alternative is to have to have to go through the steps of filling in a valid form for a frooble, but I do not really care about that at this stage, having to write them for each model will cost a lot of time and it will cause brittleness in my tests. Any suggestions? Should I give up trying to do this elegantly? Tom. -- Posted via http://www.ruby-forum.com/.
Matt Patterson
2009-Mar-20 13:15 UTC
[rspec-users] [cucumber] Creating an item without worrying about validity?
On 20 Mar 2009, at 10:59, Tom Ten Thij wrote:> In order to check at the cucumber level if permissions are working > correctly I am trying to write a cucumber scenario that tests if a > logged in user can create a certain model.Hey Tom> The alternative is to have to have to go through the steps of > filling in > a valid form for a frooble, but I do not really care about that at > this > stage, having to write them for each model will cost a lot of time and > it will cause brittleness in my tests. > > Any suggestions? Should I give up trying to do this elegantly?I wonder, if you don''t care about the actual filling in of the form, is this really a controller-level spec which has snuck into your integration-level scenarios? My gut would be to exercise the permission system in isolation at controller level and then write features to work through the actual filling stuff when that became important to me again. I.e. write ''X can create Y'' scenarios for your ''creating a Y'' feature when you need it. You could also pop in some ''X should not be able to create Y'' scenarios to exercise the refusal side of permissions, and the user experience of being refused... Matt -- Matt Patterson | Design & Code <matt at reprocessed org> | http://www.reprocessed.org/