How can I test helpers blocks in Sinatra, using Rspec?
maybe this can help you some way http://japhr.blogspot.com/2009/03/sinatra-innards-deletgator.html
Test a Sinatra app with RSpec - structure of tests
You could make just three folders: controllers
(with, for example, posts_spec.rb
), models
(that contains post_spec.rb
where testing the methods you have implemented in your model) and helpers
(let's say utils_spec.rb
).
Take a look at Testing Sinatra with Rack::Test and some repositories on GitHub to have a better idea on how you should organize your code.
How do I configure RSpec with Sinatra to dynamically determine which Sinatra app is running before my test suite runs?
Define a different helper module for each sinatra app you want to test, each of which should define its own app
method that returns the corresponding app. Then you can simply include MySinatraAppHelper
in the appropriate example groups where you want to test the the given app.
You can also use rspec metadata to have the module included in example groups automatically.
Related Topics
Need Help on Reading Emails with "Mail" Gem in Ruby
Docker-Compose Restart Connection Pool Full
Reading Files in a Zip Archive, Without Unzipping The Archive
Gem Install Rmagick Fails on Os X El Capitan
Download a Carrierwave Upload from S3
Robust Way to Deploy a Rack Application (Sinatra)
Ruby/Rails Audio Conversion Plugins
How to Deploy a Test App on Dreamhost Rails 3.0.4
How to Install Wraith on Windows 7
Regex to Check Alphanumeric String in Ruby
How to Wait for System Command to End
Hw Impossibility: "Create a Rock Paper Scissors Program in Ruby Without Using Conditionals"
How to Print a Multi-Dimensional Array in Ruby
How to Create a Custom Sort Method in Ruby