以前書いたものの続きです。 題名の通りsinatraでrspecを使う基本的なことがらになります。 sinatraだけの設定を考えるとtest/unitと同じです。乱暴に言うとassertがshouldになるだけだと思ってよいと思います。 サンプルコード 前回のサンプルコードをrspecで書く。 require './hello_world' require 'rspec' require 'rack/test' set :environment, :test describe 'The HelloWorld App' do include Rack::Test::Methods def app Sinatra::Application end it "says hello" do get '/' last_response.should be_ok last_response.body.