mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-10 17:36:33 +08:00
fixed tests
This commit is contained in:
parent
c54dd9473e
commit
ec86691659
2 changed files with 4 additions and 3 deletions
|
@ -8,7 +8,7 @@ module ClientApi
|
|||
before_action :find_user_team, only: :leave_team
|
||||
|
||||
def leave_team
|
||||
if user_cant_leave
|
||||
if user_cant_leave?
|
||||
unsuccess_response
|
||||
else
|
||||
begin
|
||||
|
@ -28,7 +28,7 @@ module ClientApi
|
|||
@user_team = UserTeam.where(team: @team, user: current_user).first
|
||||
end
|
||||
|
||||
def user_cant_leave
|
||||
def user_cant_leave?
|
||||
return unless @user_team && @team
|
||||
@user_team.admin? &&
|
||||
@team.user_teams.where(role: 2).count <= 1
|
||||
|
|
|
@ -158,7 +158,8 @@ describe User, type: :model do
|
|||
end
|
||||
let(:user_two) { create :user, email: 'user2@asdf.com' }
|
||||
|
||||
it 'in a specific format' do
|
||||
it 'in a specific format: {id: .., name: .., members: .., role: ' \
|
||||
'.., current_team: .., can_be_leaved: ..}' do
|
||||
create :user_team, team: team, user: user_one
|
||||
expected_result = {
|
||||
id: team.id,
|
||||
|
|
Loading…
Reference in a new issue