Debug with RSpec

24 views
Skip to first unread message

Evette

unread,
May 1, 2019, 9:00:08 AM5/1/19
to rspec
I am able to debug my rspec test file through RubyMine and I can use the step through debugger which has been super helpful.
But is there a way to debug through the web server whilst RSpec tests are running?

We are using the following:

rails (4.2.11, 4.2.7)

puma (3.12.1, 3.12.0)

ruby 2.3.3p222

Evette Martins

unread,
May 1, 2019, 9:22:34 AM5/1/19
to Benoit Tigeot, rs...@googlegroups.com
Sure, so I am using RubyMine to be able to do testing. The tests that I am trying to run are using capybara and javascript.
Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new(app, :browser => :chrome)
end
#Capybara.configure { |config| config.default_host = 'localhost:3000' }
Capybara.javascript_driver = :chrome
So my test is failing to login, but I believe the issue is relating to another gem we are using.
We want to debug the Webserver that capybara is using whilst running Rspec if that makes sense, to see what data it has?

On Wed, May 1, 2019 at 2:11 PM Benoit Tigeot <ben...@hopsandfork.com> wrote:

Hello Evette

We need more info to help you. What do you mean by?

> But is there a way to debug through the web server whilst RSpec tests are running?

Regards
--
You received this message because you are subscribed to the Google Groups "rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rspec+un...@googlegroups.com.
To post to this group, send email to rs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/b534176f-d97b-46ba-92b1-dfdd25e0c798%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Benoit Tigeot

unread,
May 1, 2019, 9:45:57 AM5/1/19
to rs...@googlegroups.com, Evette Martins

Benoit Tigeot

unread,
May 1, 2019, 9:45:57 AM5/1/19
to rs...@googlegroups.com, Evette

Hello Evette

We need more info to help you. What do you mean by?

> But is there a way to debug through the web server whilst RSpec tests are running?

Regards

Le 01/05/2019 à 14:56, Evette a écrit :
--

Jon Rowe

unread,
May 2, 2019, 6:06:24 AM5/2/19
to rs...@googlegroups.com, Evette Martins
To use the debugger in the web server you need one that runs in the same process as your RSpec instance, I think Rails 5/6 offers this through their system testing setup but I’m not sure.

You could instead test more of your components in isolation :)

Cheers
Jon Rowe
---------------------------

Chris Irish

unread,
May 2, 2019, 4:50:20 PM5/2/19
to rspec
Are you testing a Rails app with RSpec/Capybara?  You should be able to just put a byebug or binding.pry statement (depending on which you're using) right in your app's source.  For example in a controller action or a method in a model.

When you refresh the page or hit an api endpoint, etc.. you should jump straight into a REPL from the terminal you ran the specs from.

It should just work, I do this daily


On Wednesday, May 1, 2019 at 6:45:57 AM UTC-7, Benoit Tigeot wrote:

Hello Evette

We need more info to help you. What do you mean by?

> But is there a way to debug through the web server whilst RSpec tests are running?

Regards

Le 01/05/2019 à 14:56, Evette a écrit :
I am able to debug my rspec test file through RubyMine and I can use the step through debugger which has been super helpful.
But is there a way to debug through the web server whilst RSpec tests are running?

We are using the following:

rails (4.2.11, 4.2.7)

puma (3.12.1, 3.12.0)

ruby 2.3.3p222

--
You received this message because you are subscribed to the Google Groups "rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rs...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages