I have created simple sinatra setup.
$ bundle init
# This will create Gemfile. Open it with editor and fill in rspec and capybara
$ bundle
$ rspec --init # this will create the spec dir
# After all files are created:
$ rspec
.
Finished in 0.03381 seconds (files took 0.66163 seconds to load)
1 example, 0 failures
# and of course:
$ git add .
$ git commit -m "initial working commit"
$ git push origin master
gem 'sinatra'
group :test do
gem 'rspec'
gem 'capybara'
end
config.ru
require './main'
run Sinatra::Application
main.rb
require 'sinatra'
get '/' do
'hello'
end
spec/spec_helper.rb
require './main'
require 'capybara/rspec'
spec/features/user_visits_root_spec.rb
require 'spec_helper'
Capybara.app = Sinatra::Application
feature 'main page' do
scenario 'user sees hello' do
visit '/'
expect(page).to have_content 'Hello'
end
end