From 078b04e3a1ea2b5466041a18d35dbf0f2df498e5 Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Tue, 28 May 2013 00:38:04 +0200 Subject: [PATCH] Fix asciicast page when its author has other asciicasts --- app/decorators/asciicast_decorator.rb | 2 +- spec/features/asciicast_spec.rb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/decorators/asciicast_decorator.rb b/app/decorators/asciicast_decorator.rb index 60219a7..df7caba 100644 --- a/app/decorators/asciicast_decorator.rb +++ b/app/decorators/asciicast_decorator.rb @@ -81,7 +81,7 @@ class AsciicastDecorator < ApplicationDecorator def other_by_user if user - AsciicastDecorator.decorate( + AsciicastDecorator.decorate_collection( user.asciicasts.where('id <> ?', model.id).limit(3) ) else diff --git a/spec/features/asciicast_spec.rb b/spec/features/asciicast_spec.rb index 7eb0f45..81d19b1 100644 --- a/spec/features/asciicast_spec.rb +++ b/spec/features/asciicast_spec.rb @@ -2,7 +2,9 @@ require 'spec_helper' feature "Asciicast page", :js => true do - let(:asciicast) { load_asciicast(1) } + let!(:user) { create(:user) } + let!(:asciicast) { create(:asciicast, :user => user) } + let!(:other_asciicast) { create(:asciicast, :user => user) } scenario 'Visiting as guest' do visit asciicast_path(asciicast)