Skip to main content
0 votes
0 answers
52 views

How can I configure RSpec to always output full paths? [closed]

When I run my specs, if tests fail, I get output like this: MyClass example at ./spec/models/my_class_spec.rb:16 (FAILED - 1) my_class flunks Failures: 1) MyClass Failure/Error: it { ...
Simon's user avatar
  • 26.2k
2 votes
1 answer
61 views

Stub a method on a Thor CLI

I have a Thor class that has a getter method defined like this: # Playgrounds CLI skeleton class. # Commands are added from commands folder class CLI < Thor def self.exit_on_failure? true ...
BadIdeaException's user avatar
2 votes
0 answers
83 views

How to feed gets to avoid manual input during test execution? [duplicate]

I have a problem with one of my class methods. class Input # Method to get a valid number of days to assign prices to def Input.get_valid_number_of_days puts "Time to enter the number of ...
Neblinus's user avatar
1 vote
1 answer
80 views

How does a GitHub Actions workflow notice that a unit test has failed?

Finished in 0.0137 seconds (files took 0.0769 seconds to load) 5 examples, 1 failure Failed examples: rspec ./spec/basic_math_spec.rb:10 # Basic-Math Subtract numbers Error: Process completed with ...
cluster1's user avatar
  • 6,118
0 votes
1 answer
74 views

default_driver being ignored by Capybara in Rails/RSpec tests

I am hoping someone can point out what I am doing wrong. I wanted to configure RSpec/Capybara to do my system tests such that the default behaviour would be to run headless, but if I set js:true on ...
cpt_peter's user avatar
  • 429
1 vote
0 answers
56 views

How to sign in a user and create associated records with factories when testing

I have several tables in my application which are associated with a user. In order to run my integration tests the application first needs to log in the test user. config.before(:each, :type => ...
JesseWelch92's user avatar
3 votes
2 answers
120 views

Ignoring exit when running Rspec

In Ruby, I need to print a feedback message and then exit with a status code of 1. class Foo def bar puts "error" exit 1 end end In RSpec, how can I ignore exit 1 when expecting ...
Sig's user avatar
  • 6,140
0 votes
1 answer
25 views

Set action_mailer.default_url_options and routes.default_url_options in Rails test environment

I've seen a lot of questions about errors concerning action_mailer.default_url_options and default_url_options[:host] during system tests. Below I share a good solution I found.
broiling-clamshell's user avatar
0 votes
0 answers
46 views

Rails 7.1.5 `touch: true` causes StackLevelTooDeep with `delegated_type`

In a Rails app for managing course bookings, I want to keep the updated_at timestamps of related models in sync. Here's the setup: class ShopOrder < ApplicationRecord delegated_type :...
cuddlybunion341's user avatar
1 vote
0 answers
43 views

Caypbara/rspec throwing both `Capybara::ModalNotFound` and `Selenium::WebDriver::Error::UnexpectedAlertOpenError` in the same test

So i have a "Delete" link that brings up a html confirm modal. In my rspec system test though, it keeps erroring out with both errror messages Capybara::ModalNotFound and Selenium::WebDriver:...
ChasingTimmy's user avatar
0 votes
0 answers
74 views

RSpec -- re-evaluate allow .and_yield when mocked method is called

In this code, sync_external accepts an array of posts and modifies it by calling a sync method from an external module ExternalService, which is mocked in the test. Assume there's some reason to pass ...
Levvine's user avatar
0 votes
1 answer
46 views

New method of Rails controller being called by Rspec test

I have a Rails controller I'm trying to write a new method for, and I'm running into an issue writing the tests for it. I've simplified the methods and tests repeatedly just trying to get something to ...
Dennis Christman's user avatar
1 vote
2 answers
170 views

How to fix error in Rails Authentication generation with RSpec?

I created a new Rails 8 application. I installed RSpec for testing. $ rails g authentication invoke erb create app/views/passwords/new.html.erb create app/views/passwords/edit....
Chiara Ani's user avatar
  • 1,115
1 vote
0 answers
98 views

RSpec system specs fail without allowing JS to finish

I'm having an issue running my RSpec suite. The suite is "old," and everything worked fine until a few days ago when system specs started to fail without an apparent reason. All the failures ...
Sig's user avatar
  • 6,140
0 votes
1 answer
69 views

Iterating to create contexts from a class

I have an interesting problem, and do not know if I am overthinking something, or just missing the big picture. I have a Rspec feature test iterating over each possible “user flow”. Each “user flow” ...
I. Khan's user avatar
  • 209

15 30 50 per page
1
2 3 4 5
1219