Permalink
Browse files

pretty rspec

  • Loading branch information...
1 parent b765c0f commit 78966ac8cce9a3c9cf39f9b57ff22ae0c2e8c91f @safalmj committed Sep 3, 2012
Showing with 79 additions and 48 deletions.
  1. +79 −48 spec/requests/static_pages_spec.rb
View
127 spec/requests/static_pages_spec.rb
@@ -2,62 +2,93 @@
describe "StaticPages" do
let(:base_title) {"Ruby on Rails Tutorial Sample App"}
-
+
+ subject { page }
describe "Home page" do
- it "should have the h1 'Sample App'" do
- visit root_path
- #page.should have_content('Sample App')
- page.should have_selector('h1',
- :text => 'Sample App')
- end
-
- it "should have the title 'Home'" do
- visit root_path
- page.should have_selector('title',
- :text => "#{base_title} | Home")
- end
+ before {visit root_path}
+ it { should have_selector('h1', :text => 'Sample App')}
+ it { should have_selector('title',:text => "#{base_title} | Home")}
end
describe "Help page" do
- it "should have the h1 'Help'" do
- visit help_path
- page.should have_selector('h1',
- :text => 'Help')
- end
-
- it "should have the title 'Help'" do
- visit help_path
- page.should have_selector('title',
- :text => "#{base_title} | Help")
- end
+ before {visit help_path}
+ it { should have_selector('h1', :text => 'Help')}
+ it { should have_selector('title',:text => "#{base_title} | Help")}
end
describe "About Us" do
- it "should have the h1 'About us'" do
- visit about_path
- page.should have_selector('h1',
- :text => "About")
- end
-
- it "should have the title 'About Us'" do
- visit about_path
- page.should have_selector('title',
- :text => "#{base_title} | About")
- end
- end
+ before { visit about_path }
+ it {should have_selector('h1', :text => "About")}
+ it { should have_selector('title',:text => "#{base_title} | About")}
+ end
describe "Contact Page" do
- it "should have the h1 'Contact'" do
- visit contact_path
- page.should have_selector('h1',
- :text => "Contact")
- end
-
- it "should have the title 'Contact'" do
- visit contact_path
- page.should have_selector('title',
- :text => "#{base_title} | Contact")
- end
-
+ before { visit contact_path }
+ it { should have_selector('h1',:text => "Contact")}
+ it {should have_selector('title',:text => "#{base_title} | Contact")}
end
end
+
+# require 'spec_helper'
+
+# describe "StaticPages" do
+# let(:base_title) {"Ruby on Rails Tutorial Sample App"}
+
+# describe "Home page" do
+# it "should have the h1 'Sample App'" do
+# visit root_path
+# #page.should have_content('Sample App')
+# page.should have_selector('h1',
+# :text => 'Sample App')
+# end
+
+# it "should have the title 'Home'" do
+# visit root_path
+# page.should have_selector('title',
+# :text => "#{base_title} | Home")
+# end
+# end
+
+# describe "Help page" do
+# it "should have the h1 'Help'" do
+# visit help_path
+# page.should have_selector('h1',
+# :text => 'Help')
+# end
+
+# it "should have the title 'Help'" do
+# visit help_path
+# page.should have_selector('title',
+# :text => "#{base_title} | Help")
+# end
+# end
+
+# describe "About Us" do
+# it "should have the h1 'About us'" do
+# visit about_path
+# page.should have_selector('h1',
+# :text => "About")
+# end
+
+# it "should have the title 'About Us'" do
+# visit about_path
+# page.should have_selector('title',
+# :text => "#{base_title} | About")
+# end
+# end
+
+# describe "Contact Page" do
+# it "should have the h1 'Contact'" do
+# visit contact_path
+# page.should have_selector('h1',
+# :text => "Contact")
+# end
+
+# it "should have the title 'Contact'" do
+# visit contact_path
+# page.should have_selector('title',
+# :text => "#{base_title} | Contact")
+# end
+
+# end
+# end

0 comments on commit 78966ac

Please sign in to comment.