Railsにページを追加

どんなファイルをいじってるかまとめ

$ git diff --cached
diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb
index 19f79a9..d304760 100644
--- a/app/controllers/static_pages_controller.rb
+++ b/app/controllers/static_pages_controller.rb
@@ -7,4 +7,7 @@ class StaticPagesController < ApplicationController
 
   def about
   end
+
+  def contact
+  end
 end
diff --git a/app/views/static_pages/contact.html.erb b/app/views/static_pages/contact.html.erb
new file mode 100644
index 0000000..18967b3
--- /dev/null
+++ b/app/views/static_pages/contact.html.erb
@@ -0,0 +1,6 @@
+<% provide(:title, 'Contact') %>
+<h1>Contact</h1>
+<p>
+ Contact Ruby on Rails Tutorial about the sample app at the
+ <a href="http://railstutorial.jp/contact">contact page</a>.
+</p>
diff --git a/config/routes.rb b/config/routes.rb
index 134f94a..ed5cc87 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -2,6 +2,7 @@ SampleApp::Application.routes.draw do
   get "static_pages/home"
   get "static_pages/help"
   get "static_pages/about"
+  get "static_pages/contact"
   # The priority is based upon order of creation: first created -> highest priority.
   # See how all your routes lay out with "rake routes".
 
diff --git a/spec/requests/static_pages_spec.rb b/spec/requests/static_pages_spec.rb
index 24355cb..a93fa32 100644
--- a/spec/requests/static_pages_spec.rb
+++ b/spec/requests/static_pages_spec.rb
@@ -42,4 +42,16 @@ describe "StaticPages" do
     end
   end
 
+  describe "Contact page" do
+    it "should have the content 'Contact'" do
+        visit '/static_pages/contact'
+        expect(page).to have_content('Contact')
+    end
+
+    it "should have the title 'Contact'" do
+        visit '/static_pages/contact'
+        expect(page).to have_title("Ruby on Rails Tutorial Sample App | Contact")
+    end
+  end
+
 end