views:

32

answers:

1

I want to spec a Sinatra server that receives HTTP requests, stores things in MongoDB, and responds with JSON. How would I spec both the MongoDB entries and the responses?

I'd like to use Cucmber and RSpec to do this cause I hear they're hot, but I'm not really good with them yet.

Thanks!

Matt

+1  A: 

My learning so far with BDD is that you need to think in very small steps. E.g. you could start in making specifications with rspec for your routes, example project with sinatra, here Then you could start in making specifications for your model layer. Small steps also here, check for validations, setting and getting attributes. Last, you might approach to specify the view, here you need to learn about mocks and stubs for your controller and models.

Cucumber is a different story in my view. You need to write cucumber specifications when you work with your customer, to understand together the requirements of your app. It facilitates acceptances testing as far as I can see.

poseid