[from now] 2014/08/14 22:02:25

diff --git a/Gemfile.lock b/Gemfile.lock
index c66ce06..c9f4abe 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,6 +1,7 @@
 GEM
   remote: http://rubygems.org/
   specs:
+    backports (3.6.0)
     diff-lcs (1.2.5)
     dotenv (0.11.1)
       dotenv-deployment (~> 0.0.2)
@@ -9,9 +10,12 @@ GEM
       dotenv (~> 0.11.1)
       thor (~> 0.19.1)
     kgio (2.9.2)
+    multi_json (1.10.1)
     rack (1.5.2)
     rack-protection (1.5.3)
       rack
+    rack-test (0.6.2)
+      rack (>= 1.0)
     raindrops (0.13.0)
     rspec (3.0.0)
       rspec-core (~> 3.0.0)
@@ -29,6 +33,13 @@ GEM
       rack (~> 1.4)
       rack-protection (~> 1.4)
       tilt (~> 1.3, >= 1.3.4)
+    sinatra-contrib (1.4.2)
+      backports (>= 2.0)
+      multi_json
+      rack-protection
+      rack-test
+      sinatra (~> 1.4.0)
+      tilt (~> 1.3)
     thor (0.19.1)
     tilt (1.4.1)
     unicorn (4.8.3)
@@ -43,4 +54,5 @@ DEPENDENCIES
   foreman
   rspec
   sinatra
+  sinatra-contrib
   unicorn
diff --git a/Rakefile b/Rakefile
new file mode 100644
index 0000000..a1f32e6
--- /dev/null
+++ b/Rakefile
@@ -0,0 +1,6 @@
+require 'rspec/core'
+require 'rspec/core/rake_task'
+
+task :default => :spec
+
+RSpec::Core::RakeTask.new(:spec)
diff --git a/config.ru b/config.ru
index bea9325..9545cb3 100644
--- a/config.ru
+++ b/config.ru
@@ -1,2 +1,7 @@
 require './main.rb'
-run MainApp.new
\ No newline at end of file
+require 'rubygems'
+require 'bundler'
+
+Bundler.require
+
+run Sinatra::Application
\ No newline at end of file
diff --git a/main.rb b/main.rb
index c84cac3..517982f 100644
--- a/main.rb
+++ b/main.rb
@@ -1,12 +1,10 @@
 # coding: utf-8

 require 'sinatra'
-require 'sinatra/base'
 require 'sinatra/reloader' if development?

-class MainApp < Sinatra::Base
-  get '/' do
-    @text = 'hello'
-    erb :index
-  end
+get '/' do
+  @text = 'hello'
+  @text
+  #erb :index
 end
diff --git a/spec/main_spec.rb b/spec/main_spec.rb
new file mode 100644
index 0000000..8878edb
--- /dev/null
+++ b/spec/main_spec.rb
@@ -0,0 +1,22 @@
+# encoding: utf-8
+require File.dirname(__FILE__) + '/spec_helper'
+
+describe "App" do
+  include Rack::Test::Methods
+  def app
+    @app ||= Sinatra::Application
+  end
+
+  describe "レスポンスの精査" do
+    describe "/へのアクセス" do
+      before { get '/' }
+      subject { last_response }
+      it "正常なレスポンスが返ること" do
+        should be_ok
+      end
+      it "helloと出力されること" do
+        expect(subject.body).to eq "hello"
+      end
+    end
+  end
+end
\ No newline at end of file
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
new file mode 100644
index 0000000..2385a7b
--- /dev/null
+++ b/spec/spec_helper.rb
@@ -0,0 +1,11 @@
+require File.join(File.dirname(__FILE__), '..', 'main.rb')
+
+require 'rubygems'
+require 'sinatra'
+require 'rack/test'
+require 'rspec'
+
+set :environment, :test
+set :run, false
+set :raise_errors, true
+set :logging, false
\ No newline at end of file