2. Outline
Sinatra, Bootstrap and RSpec
• Sinatra vs. Rails
• Random Text Generator
• Sinatra Routes
• TDD with RSpec
• Bootstrap
3. Sinatra vs. Rails
• Lighter, rack-based alternative to Rails.
• Pro & Con: Less structure.
• Does not enforce MVC.
• Supports Rails toolchain: Gemfile, etc.
4. Random Text Generator
http://asdftextgenerator.com/
• Serving up asdf and Lorem Ipsum text.
• No back-end, various options available.
• Modular, reusable design.
5. Sinatra Routes
Example route pattern with named parameter
get '/hello/:name' do
# matches "GET /hello/foo" and "GET /hello/bar"
# params[:name] is 'foo' or 'bar'
"Hello #{params[:name]}!"
end
6. TDD with RSpec
Setup in spec_helper
RSpec.configure do |config|
config.include Rack::Test::Methods
end