Although integration and unit tests cover most of it, a developer will still try and test it out manually. This meant we often had to go through the tedious tasks of logging in, logging out, remembering passwords, etc. This took a lot of our precious time, which would otherwise be spent on coffee breaks, meaning we had to figure out a way to speed up things. And we did speed things up… I present to you UserSwitch.

What is UserSwitch?
UserSwitch is a Rails plugin for switching between commonly used roles and users. It’s particularly useful for development and staging environments when you often need to switch between various accounts. It saves you the hassle of logging in or out.
Why UserSwitch?
Well, it’s pretty difficult and annoying to switch between users and various user roles on big projects. What UserSwitch does is make this process easy, fast, and pretty goddamn nice. It’s also easy to plug into your existing app.
How do I get this magic thing to work?
Here in Kodius, we like to keep things simple for developers, so you will install this gem in no time.

Requirements
gem "bootstrap"
gem "devise"
Installation
Add it to your app’s Gemfile and run the bundle like this:
gem "userswitch"
or you can install it manually with:
gem install userswitch
After installing the gem you will need to create the userswitch.yml template file in your config folder with this command:
rake userswitch:create_file
Inside of this file you will set up users that are to be shown shown, edit roles and pick colors for buttons – but be very cautious, user roles need to be written exactly like user model. For example, if your model is named AdminUser then it needs to look like this:
User: dark-blue
AdminUser: red
And at the end just insert this inside of your view file where you want the switch buttons to show:
Userswitch.users(current_user)
Voila! Just like that you are ready to switch users with UserSwitch. Have fun!