How can I customize RSpec execution step?


Hello, I'm using IntelliJ Idea for Rails development.

When I open the rspec file (..._spec.rb), I can see the green icon on the left side of the code.


I can execute RSpec by clicking the icon.

Can I customize the RSpec execution steps?

Usually, it execute like "/bin/zsh -c "bash -c '/Users/kenjiotsuka2/.rvm/bin/rvm ruby-2.7.1 ..."
But I want to set up environmental variables before the test.

It is the same as executing shell script like:

export AAA=xxxxxx
export BBB=xxxxxx

Can I customize RSpec which is executed by clicking the green left icon?



you can try configuring environment variables for the RSpec run configurations template (Run - Edit Configurations - Edit Configuration Templates)


Olga Kuvardina

I added rspec configuration as follows:

I added additional environmental variables to "Environment variables".

But when I clicked the green icon and executed specific RSpec, the new configuration was created and newly added environmental variables were not applied.

Is there something wrong in my RSpec configuration?


Which RubyMine version are you using? I meant adding environment variables for Run Configuration's template. 


Olga Kuvardina

I am using 211.7142.36.

How could I configure Run Configuration's template?

When I choose "Application" in Run/Debug configurations dialog, choosing JRE and main class are required.


There should be an option at the bottom for editing configuration templates


Please sign in to leave a comment.