-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* remove N+1 queries when fetching group expiration date * update code that use user.group_expiration_date * update spec to prevent race condition * add apt-key for travis * fix apt-key to be received * use xenial instead of trusty because mysql package in trusty won't be generated anymore * remove unnecessary step
- Loading branch information
Showing
10 changed files
with
100 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,40 @@ | |
let!(:group) { FactoryBot.create(:group) } | ||
let(:user) { FactoryBot.create(:user, name: "foobar", user_login_id: "foobar", email: "[email protected]") } | ||
|
||
describe 'GET #show' do | ||
context 'unauthenticated' do | ||
it 'should return 302' do | ||
get :index | ||
|
||
expect(response).to have_http_status(302) | ||
end | ||
end | ||
|
||
context 'authenticated' do | ||
it 'should return specified user' do | ||
sign_in user | ||
get :show, params: { id: user.id } | ||
expect(response).to have_http_status(200) | ||
end | ||
|
||
it 'should populate user_groups instance variable' do | ||
sign_in user | ||
create(:group_association, group_id: group.id, user_id: user.id, expiration_date: '2020-01-01') | ||
get :show, params: { id: user.id } | ||
expected_group = assigns(:user_groups).select { |user_group| user_group.id == group.id } | ||
expect(expected_group.first.to_json).to eq( | ||
{ | ||
id: group.id, | ||
name: group.name, | ||
gid: group.gid, | ||
deleted_at: group.deleted_at, | ||
group_expiration_date: '2020-01-01', | ||
}.to_json | ||
) | ||
end | ||
end | ||
end | ||
|
||
context "update user profile" do | ||
it "should update profile with product name" do | ||
sign_in user | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters