Skip to content

Commit

Permalink
fix project page caching
Browse files Browse the repository at this point in the history
  • Loading branch information
sr committed Apr 1, 2010
1 parent 4749b2d commit 17faaea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/integrity/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def last_modified(time)

get "/:project" do
login_required unless current_project.public?
last_modified current_project.builds.max(:updated_at)
last_modified current_project.builds.max(:created_at, :updated_at)
show :project, :title => ["projects", current_project.name]
end

Expand Down
14 changes: 10 additions & 4 deletions test/acceptance/browse_builds_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class BrowseBuildsTest < Test::Unit::AcceptanceTestCase
:message => "No more pending tests :)",
:committed_at => Time.mktime(2008, 12, 15, 18)
)
Project.gen(:integrity, :builds => [build])
p = Project.gen(:integrity, :builds => [build])

visit "/integrity"

Expand All @@ -53,9 +53,15 @@ class BrowseBuildsTest < Test::Unit::AcceptanceTestCase
assert_have_tag("pre.output", :content => "This is the build output")

header "HTTP_IF_MODIFIED_SINCE", last_response["Last-Modified"]
visit "/"

visit "/integrity"
assert_equal 304, last_response.status

p.builds << Build.gen(:pending)
p.save

header "HTTP_IF_MODIFIED_SINCE", last_response["Last-Modified"]
visit "/integrity"
assert_equal 200, last_response.status
end

scenario "Browsing to an individual build page" do
Expand All @@ -80,9 +86,9 @@ class BrowseBuildsTest < Test::Unit::AcceptanceTestCase
assert_have_tag("button", :content => "Rebuild")

visit "/integrity"

header "HTTP_IF_MODIFIED_SINCE", last_response["Last-Modified"]
visit "/integrity"

assert_equal 304, last_response.status
end
end

0 comments on commit 17faaea

Please sign in to comment.