diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 61bd4a5..f5f1c35 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -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 diff --git a/spec/features/user_spec.rb b/spec/features/user_spec.rb new file mode 100644 index 0000000..dff1d92 --- /dev/null +++ b/spec/features/user_spec.rb @@ -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