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

Improve user calendar authentification and tests

parent 1f0e1656
class UsersController < ApplicationController class UsersController < ApplicationController
skip_before_filter :authenticate_user!
before_filter :set_user
layout :determine_layout layout :determine_layout
def show def show
...@@ -47,7 +49,7 @@ class UsersController < ApplicationController ...@@ -47,7 +49,7 @@ class UsersController < ApplicationController
private private
def authenticate_user! def set_user
@user = User.find_by_username!(params[:username]) @user = User.find_by_username!(params[:username])
unless current_user || @user.public_profile? unless current_user || @user.public_profile?
......
...@@ -9,18 +9,18 @@ describe UsersController do ...@@ -9,18 +9,18 @@ describe UsersController do
describe "GET #show" do describe "GET #show" do
render_views render_views
before do
get :show, username: user.username
end
it "renders the show template" do it "renders the show template" do
get :show, username: user.username
expect(response.status).to eq(200) expect(response.status).to eq(200)
expect(response).to render_template("show") expect(response).to render_template("show")
end end
end
describe "GET #calendar" do
it "renders calendar" do it "renders calendar" do
controller.prepend_view_path 'app/views/users' get :calendar, username: user.username
expect(response).to render_template("_calendar") expect(response).to render_template("calendar")
end end
end 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