fixes merge conflicts

This commit is contained in:
zmagod 2017-09-18 15:36:33 +02:00
parent b9492daa69
commit f0a8275559
3 changed files with 70 additions and 20 deletions

View file

@ -51,11 +51,8 @@ export const CONTACT_US_LINK =
// user teams
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 REMOVE_USER_FROM_TEAM_PATH = "/client_api/users/remove_user";
=======
>>>>>>> 39c9b708bdce519ada61382da731ec73052bd9b5
// settings
export const SETTINGS_ACCOUNT_PROFILE = "/settings/account/profile";

View file

@ -70,8 +70,11 @@ export default class MainNav extends Component {
path={SETTINGS_PATH}
render={() => <Redirect to={SETTINGS_ACCOUNT_PROFILE_PATH} />}
/>
<Route path={SETTINGS_ACCOUNT_PATH} component={SettingsAccount} />
<Route path={SETTINGS_TEAMS_PATH} component={SettingsTeams} />
<Route
path={SETTINGS_TEAM_ROUTE}
component={SettingsTeamPageContainer}
/>
<Route path={SETTINGS_TEAMS_ROUTE} component={SettingsTeams} />
<Route component={NotFound} />
</Switch>
</div>

View file

@ -1,32 +1,82 @@
require 'rails_helper'
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
login_user
before do
@user_one = User.first
@user_two = FactoryGirl.create(:user, email: 'sec_user@asdf.com')
@team = FactoryGirl.create :team
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
it 'should return HTTP success if user can leave the team' do
create :user_team, team: team, user: user_two
delete :leave_team,
params: { team: team.id, user_team: user_team.id },
format: :json
expect(response).to be_success
expect(response).to have_http_status(200)
expect(response).to have_http_status(:ok)
end
it 'Returns HTTP unprocessable_entity if user can\'t leave the team' do
delete :leave_team, params: { team: @team.id }, format: :json
it 'should return HTTP unprocessable_entity if user can\'t ' \
'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 have_http_status(:unprocessable_entity)
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
expect(response).to_not be_success
expect(response).to have_http_status(:unprocessable_entity)
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