Skip to content

Commit c623046

Browse files
author
Pawel
committedApr 9, 2012
Static pages tests
1 parent fe4e594 commit c623046

File tree

7 files changed

+76
-6
lines changed

7 files changed

+76
-6
lines changed
 

‎Gemfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ gem 'rails', '3.2.3'
88
gem 'sqlite3'
99

1010
group :development, :test do
11-
gem 'rspec-rails', '2.9.0'
11+
gem 'rspec-rails'
12+
gem 'webrat', '0.7.1'
1213
end
1314

1415

‎Gemfile.lock

+7-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ GEM
5555
treetop (~> 1.4.8)
5656
mime-types (1.18)
5757
multi_json (1.2.0)
58+
nokogiri (1.5.2)
5859
pg (0.12.2)
5960
polyglot (0.3.3)
6061
rack (1.4.1)
@@ -116,6 +117,10 @@ GEM
116117
uglifier (1.2.4)
117118
execjs (>= 0.3.0)
118119
multi_json (>= 1.0.2)
120+
webrat (0.7.1)
121+
nokogiri (>= 1.2.0)
122+
rack (>= 1.0)
123+
rack-test (>= 0.5.3)
119124

120125
PLATFORMS
121126
ruby
@@ -126,8 +131,9 @@ DEPENDENCIES
126131
jquery-rails
127132
pg (= 0.12.2)
128133
rails (= 3.2.3)
129-
rspec-rails (= 2.9.0)
134+
rspec-rails
130135
sass-rails (~> 3.2.3)
131136
sqlite3
132137
therubyracer
133138
uglifier (>= 1.0.3)
139+
webrat (= 0.7.1)

‎app/views/static_pages/help.html.erb

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
1-
<h1>StaticPages#help</h1>
2-
<p>Find me in app/views/static_pages/help.html.erb</p>
1+
<h1>Help</h1>
2+
<p>
3+
Get help on the Ruby on Rails Tutorial at the
4+
<a href="http://railstutorial.org/help">Rails Tutorial help page</a>.
5+
To get help on this sample app, see the
6+
<a href="http://railstutorial.org/book">Rails Tutorial book</a>.
7+
</p>

‎app/views/static_pages/home.html.erb

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
<h1>StaticPages#home</h1>
2-
<p>Find me in app/views/static_pages/home.html.erb</p>
1+
<h1>Sample App</h1>
2+
<p>
3+
This is the home page for the
4+
<a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
5+
sample application.
6+
</p>

‎config/routes.rb

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
get "static_pages/home"
33

44
get "static_pages/help"
5+
6+
get "static_pages/about"
57

68
# The priority is based upon order of creation:
79
# first created -> highest priority.

‎spec/requests/static_pages_spec.rb

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
require 'spec_helper'
2+
3+
describe "Static pages" do
4+
5+
describe "Home page" do
6+
7+
it "should have the content 'Sample App'" do
8+
visit '/static_pages/home'
9+
page.should have_content('Sample App')
10+
end
11+
end
12+
13+
describe "Help page" do
14+
15+
it "should have the content 'Help'" do
16+
visit '/static_pages/help'
17+
page.should have_content('Help')
18+
end
19+
end
20+
21+
describe "About page" do
22+
23+
it "should have the content 'About Us'" do
24+
visit '/static_pages/about'
25+
page.should have_content('About Us')
26+
end
27+
end
28+
end

‎webrat.log

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logfile created on 2012-04-09 15:27:08 +0200 by logger.rb/31641
2+
REQUESTING PAGE: GET /static_pages/home with {} and HTTP headers {}
3+
REQUESTING PAGE: GET /static_pages/help with {} and HTTP headers {}
4+
REQUESTING PAGE: GET /static_pages/home with {} and HTTP headers {}
5+
REQUESTING PAGE: GET /static_pages/help with {} and HTTP headers {}
6+
REQUESTING PAGE: GET /static_pages/home with {} and HTTP headers {}
7+
REQUESTING PAGE: GET /static_pages/help with {} and HTTP headers {}
8+
REQUESTING PAGE: GET /static_pages/home with {} and HTTP headers {}
9+
REQUESTING PAGE: GET /static_pages/help with {} and HTTP headers {}
10+
REQUESTING PAGE: GET /static_pages/home with {} and HTTP headers {}
11+
REQUESTING PAGE: GET /static_pages/help with {} and HTTP headers {}
12+
REQUESTING PAGE: GET /static_pages/about with {} and HTTP headers {}
13+
REQUESTING PAGE: GET /static_pages/home with {} and HTTP headers {}
14+
REQUESTING PAGE: GET /static_pages/help with {} and HTTP headers {}
15+
REQUESTING PAGE: GET /static_pages/about with {} and HTTP headers {}
16+
REQUESTING PAGE: GET /static_pages/home with {} and HTTP headers {}
17+
REQUESTING PAGE: GET /static_pages/help with {} and HTTP headers {}
18+
REQUESTING PAGE: GET /static_pages/about with {} and HTTP headers {}
19+
REQUESTING PAGE: GET /static_pages/home with {} and HTTP headers {}
20+
REQUESTING PAGE: GET /static_pages/help with {} and HTTP headers {}
21+
REQUESTING PAGE: GET /static_pages/about with {} and HTTP headers {}
22+
REQUESTING PAGE: GET /static_pages/home with {} and HTTP headers {}
23+
REQUESTING PAGE: GET /static_pages/help with {} and HTTP headers {}
24+
REQUESTING PAGE: GET /static_pages/about with {} and HTTP headers {}

0 commit comments

Comments
 (0)
Please sign in to comment.