There are two approaches to staging environments.
You change the RAILS_ENV environment variable to staging: RAILS_ENV=staging
This will tell Rails to load the staging environment.
This requires a config/environments/staging.rb file and matching configuration in config/cable.yml, Rails credentials, etc. We recommend copying your production configs to staging and making any modifications you need.
This approach is nice because you can easily customize any features that need to work differently in staging and commit them to your git repository.
Separate app with Environment Variables
Another, safer, option is to leave RAILS_ENV=production. This will run the real production configuration and will be as close to production as possible for testing.
However, this will use production credentials by default, so you may want to override those with environment variables. For example, you might want to override the mailer so it doesn't send emails to real users.