diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-07-24 09:29:58 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-07-24 09:29:58 +0000 |
commit | 0c1d912559fa1cd6b209af609ee192a5cd10c455 (patch) | |
tree | a314504cb9ca6a1d9d92a0a70b67b042d3e2ea94 /spec/controllers | |
parent | 7e262ebf157f2af4658485aae7073d315648cfa7 (diff) | |
parent | 5ce6d18681ee7b74ba0c443672224dd580bd34b0 (diff) | |
download | gitlab-ce-0c1d912559fa1cd6b209af609ee192a5cd10c455.tar.gz |
Merge branch 'rs-issue-2012' into 'master'
Make username parameter for Users#show case-insensitive
Closes #2012
See merge request !996
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/users_controller_spec.rb | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index d47a37914df..9f89101d7f7 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -1,25 +1,38 @@ require 'spec_helper' describe UsersController do - let(:user) { create(:user, username: 'user1', name: 'User 1', email: 'user1@gitlab.com') } - - before do - sign_in(user) - end + let(:user) { create(:user) } describe 'GET #show' do - render_views + it 'is case-insensitive' do + user = create(:user, username: 'CamelCaseUser') + sign_in(user) + + get :show, username: user.username.downcase - it 'renders the show template' do - get :show, username: user.username - expect(response.status).to eq(200) - expect(response).to render_template('show') + expect(response).to be_success + end + + context 'with rendered views' do + render_views + + it 'renders the show template' do + sign_in(user) + + get :show, username: user.username + + expect(response).to be_success + expect(response).to render_template('show') + end end end describe 'GET #calendar' do it 'renders calendar' do + sign_in(user) + get :calendar, username: user.username + expect(response).to render_template('calendar') end end @@ -30,6 +43,8 @@ describe UsersController do before do allow_any_instance_of(User).to receive(:contributed_projects_ids).and_return([project.id]) + + sign_in(user) project.team << [user, :developer] end |