How can I customize RSpec execution step?

Answered

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?

0
5 comments

Hello,

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

0

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?

0

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

0

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.

0

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

0

Please sign in to leave a comment.