Permalink
Browse files

Episodes I have seen do not interest me.

  • Loading branch information...
1 parent 3514181 commit 3ca4137c8297fbeb1066a4a1e11c1084c28d5b82 @tomlea committed Apr 30, 2009
Showing with 14 additions and 1 deletion.
  1. +1 −1 app/controllers/home_controller.rb
  2. +13 −0 test/functional/home_controller_test.rb
@@ -1,5 +1,5 @@
class HomeController < ApplicationController
def index
- @fresh_episodes = Show.most_recently_updated.reject{|show| show.episodes.last_changed < 7.days.ago }
+ @fresh_episodes = Show.most_recently_updated.reject{|show| show.episodes.last_changed < 7.days.ago }.reject{|show| show.episodes.all?(&:seen?)}
end
end
@@ -36,6 +36,19 @@ class HomeControllerTest < ActionController::TestCase
should_render_with_layout "master"
end
+ static_context "and we have seen all the simpsons episodes" do
+ static_setup do
+ @the_simpsons.episodes.each(&:seen!)
+ get :index
+ end
+
+ should_respond_with :success
+
+ should "not list The Simpsons in the most recently updated shows" do
+ assert !assigns(:fresh_episodes).include?(@the_simpsons)
+ end
+ end
+
static_context "and a new episode of the west wing has been found" do
static_setup do
Factory(:episode, :show => @west_wing)

0 comments on commit 3ca4137

Please sign in to comment.