mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-05 20:54:27 +08:00
fixes merge conflicts
This commit is contained in:
parent
b9492daa69
commit
f0a8275559
3 changed files with 70 additions and 20 deletions
|
@ -51,11 +51,8 @@ export const CONTACT_US_LINK =
|
||||||
|
|
||||||
// user teams
|
// user teams
|
||||||
export const LEAVE_TEAM_PATH = "/client_api/users/leave_team";
|
export const LEAVE_TEAM_PATH = "/client_api/users/leave_team";
|
||||||
<<<<<<< HEAD
|
|
||||||
export const UPDATE_USER_TEAM_ROLE_PATH = "/client_api/users/update_role";
|
export const UPDATE_USER_TEAM_ROLE_PATH = "/client_api/users/update_role";
|
||||||
export const REMOVE_USER_FROM_TEAM_PATH = "/client_api/users/remove_user";
|
export const REMOVE_USER_FROM_TEAM_PATH = "/client_api/users/remove_user";
|
||||||
=======
|
|
||||||
>>>>>>> 39c9b708bdce519ada61382da731ec73052bd9b5
|
|
||||||
|
|
||||||
// settings
|
// settings
|
||||||
export const SETTINGS_ACCOUNT_PROFILE = "/settings/account/profile";
|
export const SETTINGS_ACCOUNT_PROFILE = "/settings/account/profile";
|
||||||
|
|
|
@ -70,8 +70,11 @@ export default class MainNav extends Component {
|
||||||
path={SETTINGS_PATH}
|
path={SETTINGS_PATH}
|
||||||
render={() => <Redirect to={SETTINGS_ACCOUNT_PROFILE_PATH} />}
|
render={() => <Redirect to={SETTINGS_ACCOUNT_PROFILE_PATH} />}
|
||||||
/>
|
/>
|
||||||
<Route path={SETTINGS_ACCOUNT_PATH} component={SettingsAccount} />
|
<Route
|
||||||
<Route path={SETTINGS_TEAMS_PATH} component={SettingsTeams} />
|
path={SETTINGS_TEAM_ROUTE}
|
||||||
|
component={SettingsTeamPageContainer}
|
||||||
|
/>
|
||||||
|
<Route path={SETTINGS_TEAMS_ROUTE} component={SettingsTeams} />
|
||||||
<Route component={NotFound} />
|
<Route component={NotFound} />
|
||||||
</Switch>
|
</Switch>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,32 +1,82 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe ClientApi::Users::UserTeamsController, type: :controller do
|
describe ClientApi::Users::UserTeamsController, type: :controller do
|
||||||
|
login_user
|
||||||
|
let(:user_one) { User.first }
|
||||||
|
let(:user_two) { create :user, email: Faker::Internet.email }
|
||||||
|
let(:team) { create :team }
|
||||||
|
let(:user_team) { create :user_team, team: team, user: user_one }
|
||||||
|
|
||||||
describe 'DELETE #leave_team' do
|
describe 'DELETE #leave_team' do
|
||||||
login_user
|
it 'should return HTTP success if user can leave the team' do
|
||||||
before do
|
create :user_team, team: team, user: user_two
|
||||||
@user_one = User.first
|
delete :leave_team,
|
||||||
@user_two = FactoryGirl.create(:user, email: 'sec_user@asdf.com')
|
params: { team: team.id, user_team: user_team.id },
|
||||||
@team = FactoryGirl.create :team
|
format: :json
|
||||||
FactoryGirl.create :user_team, team: @team, user: @user_one, role: 2
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'Returns HTTP success if user can leave the team' do
|
|
||||||
FactoryGirl.create :user_team, team: @team, user: @user_two, role: 2
|
|
||||||
delete :leave_team, params: { team: @team.id }, format: :json
|
|
||||||
expect(response).to be_success
|
expect(response).to be_success
|
||||||
expect(response).to have_http_status(200)
|
expect(response).to have_http_status(:ok)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'Returns HTTP unprocessable_entity if user can\'t leave the team' do
|
it 'should return HTTP unprocessable_entity if user can\'t ' \
|
||||||
delete :leave_team, params: { team: @team.id }, format: :json
|
'leave the team' do
|
||||||
|
delete :leave_team,
|
||||||
|
params: { team: team.id, user_team: user_team.id },
|
||||||
|
format: :json
|
||||||
expect(response).to_not be_success
|
expect(response).to_not be_success
|
||||||
expect(response).to have_http_status(:unprocessable_entity)
|
expect(response).to have_http_status(:unprocessable_entity)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'Returns HTTP unprocessable_entity if no params given' do
|
it 'should return HTTP unprocessable_entity if no params given' do
|
||||||
delete :leave_team, format: :json
|
delete :leave_team, format: :json
|
||||||
expect(response).to_not be_success
|
expect(response).to_not be_success
|
||||||
expect(response).to have_http_status(:unprocessable_entity)
|
expect(response).to have_http_status(:unprocessable_entity)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'POST #update_role' do
|
||||||
|
it 'should return HTTP success if user can leave the team' do
|
||||||
|
user_team_two = create :user_team, team: team, user: user_two, role: 2
|
||||||
|
post :update_role,
|
||||||
|
params: { team: team.id,
|
||||||
|
user_team: user_team_two.id,
|
||||||
|
role: 'normal_user' },
|
||||||
|
format: :json
|
||||||
|
expect(response).to be_success
|
||||||
|
expect(response).to have_http_status(:ok)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should return HTTP unprocessable_entity if user can\'t ' \
|
||||||
|
'leave the team' do
|
||||||
|
post :update_role,
|
||||||
|
params: { team: team.id,
|
||||||
|
user_team: user_team.id,
|
||||||
|
role: 'normal_user' },
|
||||||
|
format: :json
|
||||||
|
expect(response).to_not be_success
|
||||||
|
expect(response).to have_http_status(:unprocessable_entity)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'DELETE #remove_user' do
|
||||||
|
it 'should return HTTP success if user can be removed' do
|
||||||
|
user_team
|
||||||
|
user_team_two = create :user_team, team: team, user: user_two
|
||||||
|
post :remove_user,
|
||||||
|
params: { team: team.id, user_team: user_team_two.id },
|
||||||
|
format: :json
|
||||||
|
expect(response).to be_success
|
||||||
|
expect(response).to have_http_status(:ok)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should return HTTP unprocessable_entity if user can\'t ' \
|
||||||
|
'be removed' do
|
||||||
|
post :remove_user,
|
||||||
|
params: { team: team.id,
|
||||||
|
user_team: user_team.id,
|
||||||
|
role: 'normal_user' },
|
||||||
|
format: :json
|
||||||
|
expect(response).to_not be_success
|
||||||
|
expect(response).to have_http_status(:unprocessable_entity)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue