Sinatra Basics : Running Rspec Tests and Sinatra Console
To learn how to use rake to run all rspec tests in a Sinatra application and to create your own Sinatra console.
begin require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) task :default => :spec rescue LoadError # no rspec available end
Now you can run all the tests by running the rake command.
Console for Sinatra application:
desc "Open an irb session preloaded with your model" task :console do require 'active_record' require './app/models/article.rb' require 'irb' ARGV.clear IRB.start end
To experiment in a Sinatra console:
In this article, you learned how to run all tests using a rake task and how to create your own Sinatra console similar to rails console.
Ace the Technical Interview
- Easily find the gaps in your knowledge
- Get customized lessons based on where you are
- Take consistent action everyday
- Builtin accountability to keep you on track
- You will solve bigger problems over time
- Get the job of your dreams
Take the 30 Day Coding Skills Challenge
Gain confidence to attend the interview