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?

5 comments
Comment actions Permalink

Hello,

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

0
Comment actions Permalink

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
Comment actions Permalink

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

0
Comment actions Permalink

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
Comment actions Permalink

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

0

Please sign in to leave a comment.