Question

I have feature specs in my Rails app that use Capybara to run tests through a browser. By default they use the phantomjs/poltergeist and rack-test drivers, which are headless.

It often is desirable to run a single spec (or spec file) using a capybara driver that runs a visible browser so that I can see what is happening. For this use case I use Selenium. When I want to run a spec using Selenium I set an environment variable (DEBUG=true) before running rspec like so:

DEBUG=true rspec spec/features/my_spec.rb

My spec_helper looks for the DEBUG environment variable and runs the spec with Selenium instead of the default drivers. I'd like to duplicate this capability in Rubymine, so that when I right-click on a spec in the project tree and click "Debug 'Run spec...'" it sets up the DEBUG environment variable and runs the spec with the Selenium driver. How can I configure the default 'Debug' configuration to set up this environment variable?

Was it helpful?

Solution

Next to the run button on the tool bar, there's the name of the configuration that is active, click it and choose Edit Configuration inside you'll find server arguments you can write there the DEBUG=true and it will be sent to the runner file.

Location of configuration

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top