Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Failing tests for #87 * Inserted dropdown and user name with link to profile * added simple pagination * Moved Role managment to users#index and implmented set roles * travis needs Gemfile.lock * Implemented search bar * update_role not needed here * remove unneccessary elemetns * display notice on role update * remove profiles index page, user administration is handled by users index page * remove role selection for users * add translation for role adiminstration * add missing translation for will_paginate * remove index routing spec * add and correct tests * pupil is called Nutzer * cleanup unneccessary functions * adapt search to use first/last_name from profile of user * add missing feature test for search bar * use bootstrap extension of will_paginate * localize created_at * order users by profile.first_name * increase users per page to 100 * there is no role teacher * adapt tests and create user controller spec * implement special organizer permissions for user managment * change pagination to 20 * finish user controller test and adapt roles for organizers * use bootstrap for search bar * fix test for search button
- Loading branch information
Showing
12 changed files
with
178 additions
and
37 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
de: | ||
will_paginate: | ||
previous_label: "← Vorherige" | ||
next_label: "Nächste →" | ||
previous_label: "«" | ||
next_label: "»" | ||
page_gap: "…" |
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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe UsersController, type: :controller do | ||
|
||
let(:valid_attributes) { FactoryGirl.attributes_for(:user) } | ||
|
||
describe "PUT #update" do | ||
|
||
before :each do | ||
request.env['HTTP_REFERER'] = root_url | ||
end | ||
|
||
context "as organizer" do | ||
|
||
before :each do | ||
sign_in FactoryGirl.create(:user, role: :organizer) | ||
end | ||
|
||
it "can update the role of a pupil to coach" do | ||
@test_user = FactoryGirl.create(:user, role: :pupil) | ||
put :update_role, id: @test_user.id, user: {role: "coach"} | ||
@test_user.reload | ||
expect(@test_user.role).to eq("coach") | ||
end | ||
|
||
it "cannot update the role of an admin" do | ||
@test_user = FactoryGirl.create(:user, role: :admin) | ||
put :update_role, id: @test_user.id, user: {role: "coach"} | ||
@test_user.reload | ||
expect(@test_user.role).to eq("admin") | ||
end | ||
|
||
it "cannot update role to admin" do | ||
@test_user = FactoryGirl.create(:user, role: :coach) | ||
@test_user.role = "pupil" | ||
put :update_role, id: @test_user.id, user: {role: "admin"} | ||
@test_user.reload | ||
expect(@test_user.role).to eq("coach") | ||
end | ||
end | ||
|
||
context "as admin" do | ||
|
||
before :each do | ||
sign_in FactoryGirl.create(:user, role: :admin) | ||
end | ||
|
||
it "can update the role of a pupil to coach" do | ||
@test_user = FactoryGirl.create(:user, role: :pupil) | ||
put :update_role, id: @test_user.id, user: {role: "coach"} | ||
@test_user.reload | ||
expect(@test_user.role).to eq("coach") | ||
end | ||
|
||
it "can update the role of an admin" do | ||
@test_user = FactoryGirl.create(:user, role: :admin) | ||
put :update_role, id: @test_user.id, user: {role: "coach"} | ||
@test_user.reload | ||
expect(@test_user.role).to eq("coach") | ||
end | ||
|
||
it "can update role to admin" do | ||
@test_user = FactoryGirl.create(:user, role: :coach) | ||
@test_user.role = "pupil" | ||
put :update_role, id: @test_user.id, user: {role: "admin"} | ||
@test_user.reload | ||
expect(@test_user.role).to eq("admin") | ||
end | ||
end | ||
end | ||
end |
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