I am new to Ruby and have been asked to use it in our new project. We have also been asked to use Padrino (Sinatra) as backend/framework. For testing we have been asked to use Rspec. I have been hunting for tutorials for long that would guide in using Rspec for Ruby on Padrino. What I get is mostly with reference to RoR. But, I am in need of Ruby on Padrino.
Please guide me for the same with any starters/guides/references/discussions, etc.
Please correct me, if I am wrong anywhere. May be I haven’t searched with the right combination of words/phrases for my issue.
I am using Ruby 1.9.3 and Padrino v.0.10.6.
Note : I have also referred the SO question, but it didn’t help.
I never used Padrino, but it seems that it isn’t much different from Sinatra.
I suggest reading Sinatra and RSpec resources.
You can get started with this:
And by reading specs that were written by other people on GitHub. These are some of mine, but they are not the cleanest thing that exists.
EDIT: a short tutorial
Getting started with this framework is much quicker and easier than with Sinatra. 🙂
Install Padrino:
gem install padrinoCreate an application:
padrino g project myapp -d datamapper -t rspecThe command speaks for itself. 🙂
Run the tests:
rspec --colorNo tests were found, obviously. Let’s create one in
spec/hello/hello_spec.rb:Run the tests again.
They failed, because no route
get '/'exists. Let’s create it.In
app/controllers/hello.rb:Run the test: it passes!
Check Padrino’s documentation for more information and cool features, such as the controllers generator and the admin interface.
Good luck!