Commit 08582f15 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Improve user calendar authentification and tests

parent 1f0e1656
class UsersController < ApplicationController
skip_before_filter :authenticate_user!
before_filter :set_user
layout :determine_layout
def show
......@@ -47,7 +49,7 @@ class UsersController < ApplicationController
private
def authenticate_user!
def set_user
@user = User.find_by_username!(params[:username])
unless current_user || @user.public_profile?
......
......@@ -9,18 +9,18 @@ describe UsersController do
describe "GET #show" do
render_views
before do
get :show, username: user.username
end
it "renders the show template" do
get :show, username: user.username
expect(response.status).to eq(200)
expect(response).to render_template("show")
end
end
describe "GET #calendar" do
it "renders calendar" do
controller.prepend_view_path 'app/views/users'
expect(response).to render_template("_calendar")
get :calendar, username: user.username
expect(response).to render_template("calendar")
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment