aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/new_base/etag_test.rb
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2009-05-26 11:34:02 -0300
committerEmilio Tagua <miloops@gmail.com>2009-05-26 11:34:02 -0300
commitb3d40546923b194a89be0d9e00758864fa60b9e8 (patch)
tree8acac475b371d61924c67a439704c82c61968fff /actionpack/test/new_base/etag_test.rb
parentaa5512299041efb923cd582fd26009a72b9ec670 (diff)
parent2f59066470193c6219dfd958fc5d8096a2ddee68 (diff)
downloadrails-b3d40546923b194a89be0d9e00758864fa60b9e8.tar.gz
rails-b3d40546923b194a89be0d9e00758864fa60b9e8.tar.bz2
rails-b3d40546923b194a89be0d9e00758864fa60b9e8.zip
Merge commit 'rails/master'
Diffstat (limited to 'actionpack/test/new_base/etag_test.rb')
-rw-r--r--actionpack/test/new_base/etag_test.rb25
1 files changed, 12 insertions, 13 deletions
diff --git a/actionpack/test/new_base/etag_test.rb b/actionpack/test/new_base/etag_test.rb
index 7af5febfb3..a40d3c936a 100644
--- a/actionpack/test/new_base/etag_test.rb
+++ b/actionpack/test/new_base/etag_test.rb
@@ -1,47 +1,46 @@
require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
module Etags
-
class BasicController < ActionController::Base
-
self.view_paths = [ActionView::Template::FixturePath.new(
"etags/basic/base.html.erb" => "Hello from without_layout.html.erb",
"layouts/etags.html.erb" => "teh <%= yield %> tagz"
)]
-
+
def without_layout
render :action => "base"
end
-
+
def with_layout
- render :action => "base", :layout => "etag"
+ render :action => "base", :layout => "etags"
end
-
end
-
- class TestBasic < SimpleRouteCase
+
+ class EtagTest < SimpleRouteCase
describe "Rendering without any special etag options returns an etag that is an MD5 hash of its text"
-
+
test "an action without a layout" do
get "/etags/basic/without_layout"
+
body = "Hello from without_layout.html.erb"
assert_body body
assert_header "Etag", etag_for(body)
assert_status 200
end
-
+
test "an action with a layout" do
get "/etags/basic/with_layout"
+
body = "teh Hello from without_layout.html.erb tagz"
assert_body body
assert_header "Etag", etag_for(body)
assert_status 200
end
-
+
+ private
+
def etag_for(text)
%("#{Digest::MD5.hexdigest(text)}")
end
end
-
-
end \ No newline at end of file