Fix UsersController#show

This commit is contained in:
Marcin Kulik 2013-05-27 22:04:31 +02:00
parent a6bbdf7a39
commit 7659fe722e
2 changed files with 19 additions and 2 deletions

View File

@ -4,7 +4,7 @@ class UsersController < ApplicationController
before_filter :ensure_authenticated!, :only => [:edit, :update]
def show
@user = UserDecorator.find_by_nickname!(params[:nickname])
@user = User.find_by_nickname!(params[:nickname]).decorate
collection = @user.asciicasts.
includes(:user).
@ -12,7 +12,7 @@ class UsersController < ApplicationController
page(params[:page]).
per(PER_PAGE)
@asciicasts = AsciicastDecorator.decorate(collection)
@asciicasts = PaginatingDecorator.new(collection)
end
def create

View File

@ -0,0 +1,17 @@
require 'spec_helper'
feature "User's profile" do
let!(:user) { create(:user) }
let!(:asciicast) { create(:asciicast, :user => user, :title => 'Tricks!') }
scenario 'Visiting' do
visit profile_path(user)
expect(page).to have_content(/Asciicasts by ~#{user.nickname}/i)
expect(page).to have_content('1 asciicasts')
expect(page).to have_link('Tricks!')
expect(page).to have_selector('.supplimental .play-button')
end
end