Skip to main content
Filter by
Sorted by
Tagged with
2 votes
1 answer
70 views

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
88 views

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
95 views

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,128
0 votes
1 answer
79 views

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
1 answer
64 views

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
126 views

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,150
0 votes
1 answer
27 views

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
49 views

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
47 views

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
79 views

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
47 views

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
176 views

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,135
1 vote
0 answers
100 views

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,150
0 votes
1 answer
76 views

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
0 votes
1 answer
50 views

I have a Rails 6.1 controller that sets: # File: app/controllers/foo_controller.rb rescue_from Exception, with: :error_handler My Rspec 6.1 test (is a "request" type) is like: # File: spec/...
aarkerio's user avatar
  • 2,404
1 vote
0 answers
290 views

I migrated Rails from version 7 to 8 and I noticed that the Spring gem was removed from Rails 8. I suspect this might be someway contributing to my RSpec test suite running significantly slower, ...
user502052's user avatar
  • 15.3k
0 votes
1 answer
184 views

I have the following Ruby class I want to test: class Logger # ... def process X.process rescue StandardError => e ::Rails.logger.error('Progname') { 'Could not produce the audit log'...
Aymeric's user avatar
  • 906
0 votes
1 answer
120 views

We have some helper_methods in our controllers that are used across both the controller and the view they render. For example: helper_method :example_method def example_method @example_method ||= ...
Cameron's user avatar
  • 28.9k
1 vote
2 answers
111 views

I have this Rails 6.1 model: class BankAccount < ApplicationRecord belongs_to :donor before_validation -> { puts #AccAuth: #{account_authorization}" } validates :...
aarkerio's user avatar
  • 2,404
0 votes
1 answer
37 views

I've got a spec helper that, in an after hook, checks the output of a method call. The hook itself just calls a method from an included module, and I've tested all that successfully. Now I want to ...
Jaffa's user avatar
  • 12.7k
-1 votes
1 answer
99 views

Currently, we are using the stripe-ruby-mock gem in our application for testing Stripe APIs Integration, along with Stripe version '2015-04-07'. As we proceed with the Stripe upgrade and aim to ...
Pankaj Bagdare's user avatar
1 vote
1 answer
142 views

I'm having an issue with SonarQube and I would like to know if anyone can help me. My application can only pass if at least 80% of the code is covered by tests. In my controller, I have the cancel ...
Rodrigo Almeida's user avatar
1 vote
0 answers
62 views

I just updated my app to rails 8 with the newest version of Devise and hotwire turbo. When running tests with Capybara/Rspec I'm seeing certain form submissions fail with a 500 error from inside of ...
dthegnome's user avatar
  • 133
1 vote
0 answers
40 views

I've implemented screenshot capturing for my automation project using rspec/capybara. I was expecting capybara to take a screenshot each time a test fails, no matter where it fails (in preconditions ...
VLAD 's user avatar
  • 11
1 vote
1 answer
133 views

I have an ActiveRecord table with a column called name. I need this field to be present and unique. So I have the following specs it { should validate_presence_of(:name) } it { should ...
mrateb's user avatar
  • 2,519
0 votes
1 answer
179 views

When running my tests in a Rails application, I see the following deprecation warning multiple times: DEPRECATION WARNING: Bolding log text with a positional boolean is deprecated and will be removed ...
Samuel Da Costa's user avatar
0 votes
1 answer
105 views

Working with rspec-expectations 3.13.3 and have code such as: def methname(**kwargs) # let's assume this method doesn't mind whether the kwargs are keyed by symbols or strings p(received: kwargs) ...
Tim Diggins's user avatar
  • 4,566
1 vote
1 answer
76 views

I have the following method: def clone(branch: nil, depth: nil) ... end For a particular test case, I want to test that the method is called without the branch argument. In Ruby 2.x the following ...
Sergio's user avatar
  • 271
0 votes
3 answers
173 views

Let's say I have a class with a method that modifies and returns a hash. When testing the class the method will be called, but for the purposes of the test, I want it to return its argument ...
dB''s user avatar
  • 8,470
0 votes
0 answers
92 views

Let's say there's a method report defined on ErrorReporter module. In my RSpec test suite I'd like to somehow globally stub this method so that test fails if it's not explicitly expected to receive ...
vetements's user avatar
0 votes
2 answers
116 views

In my routes.rb file I had this route: resources :profiles In my controller specs I had thus paths such as: profiles_path new_profile_path etc. Now I had to move this inside a namespace. The new ...
mrateb's user avatar
  • 2,519
-1 votes
2 answers
493 views

I am trying to install factory_bot_rails to use with rspec. I am working my way through Everyday Rails Testing with RSpec A practical approach to test-driven development, by Aaron Sumner, http://...
Jennifer James's user avatar
1 vote
2 answers
73 views

In my Rails application I have a model Profile that belongs_to a User as such: class User < ApplicationRecord has_many :profiles end class Profile < ApplicationRecord belongs_to :user ...
mrateb's user avatar
  • 2,519
1 vote
0 answers
79 views

I'm working on a Rails API with GraphQL, and I'm having issues with testing a mutation using RSpec. When I use the /graphiql route and provide the required headers manually, everything works perfectly....
José Sávio's user avatar
0 votes
3 answers
93 views

For a very basic controller action such as: def new @user = User.new end Simplecov wants this assignment tested. I can't think of anyway to test it other than using the rails-controller-testing gem ...
Chad's user avatar
  • 768
0 votes
0 answers
51 views

I'm trying to write an RSpec system spec to test working functionality through a responsive web layout that could emulate how one would use things in a mobile. How do I get the window size to have a ...
boddhisattva's user avatar
  • 7,460
-2 votes
1 answer
54 views

In my Rails application, ruby 2.6.5, rails 6.1. I use Active admin and I created this page. How can I create some tests for this using rspec? I have already created tests for the model and the ...
Karina Piloupas's user avatar
0 votes
1 answer
131 views

I'm using rails 6.1 with ruby 2.6.5 and I’m creating tests for an Active Admin new page, The best way I found to test this new page was by using the gems Capybara, Webdrivers, and Selenium-Webdrivers. ...
Rodrigo Almeida's user avatar
1 vote
2 answers
370 views

Issue How can I write a rswag spec that would pass my_field: 'my_value' into my controller's params for a GET request? Initial attempt config/routes.rb: Rails.application.routes.draw do namespace :...
Augustinas's user avatar
1 vote
0 answers
78 views

class Foo def fizz(user) puts user end end let(:user){create(:user)} it do expect(Foo).to receive(:fizz).with(user) end I run this test in RSpec of Rails app. Test fails with below ...
nrmn0006's user avatar
0 votes
1 answer
81 views

Why does the following test give me a TypeError: expected numeric error: it { expect(DateTime.now).to be_within(1.second).of Time.zone.now } but this test does not? it { expect(DateTime.now).to ...
aarona's user avatar
  • 37.7k
1 vote
0 answers
25 views

I'm running into trouble with my test. Here it is. It performs a number of inserts into a C database db. The problem is that my test doesn't seem to actually do the number of inserts. If I specify the ...
Eugene's user avatar
  • 11
0 votes
0 answers
190 views

We have a big old build that is taking too long to run tests and Im trying to setup parallelism to speed things up. After the configuration, I can see the tests are indeed running in parallel and are ...
João Menighin's user avatar
1 vote
3 answers
112 views

When to_json is called on an object in Rails, the datetime objects are converted to the ISO 8601 standard automatically which is an excellent tool for sending data back to a client. [43] pry(main)> ...
Arslan Ali's user avatar
  • 17.9k
2 votes
2 answers
144 views

As you can see from the github issue, RSwag does not support multiple headers for api Key authentication. This is my openapi/swagger yml, in following with Multiple API Key Setup in swagger docs: ...
Ben G's user avatar
  • 26.9k
0 votes
1 answer
100 views

Ruby: 3.4.0-preview1 rspec: 3.13.0 .rspec --warning spec_helper.rb $LOAD_PATH.unshift File.expand_path('../lib', __dir__) require 'rspec/its' RSpec.configure do |config| config....
0lli.rocks's user avatar
  • 1,082
0 votes
1 answer
78 views

I have installed this gem to validate and test active storage: gem 'active_storage_validations' gem 'shoulda-matchers', '~> 6.0' # app/models/asset.rb class Asset < ApplicationRecord ...
Chiara Ani's user avatar
  • 1,135
0 votes
1 answer
86 views

I have installed this gem to validate and test active storage: gem 'active_storage_validations' # Asset Model class Asset < ApplicationRecord has_one_attached :portrait validates( :...
Chiara Ani's user avatar
  • 1,135
1 vote
1 answer
85 views

Let's say I have: class Foo def do_thing(arg_one:, arg_two:) # ... end end class Bar def initialize(foo) @foo = foo end def do_delegated_thing @foo.do_thing(arg_one: "x&...
aarestad's user avatar
  • 607
0 votes
1 answer
183 views

I have always used Capybara with Rspec and with Rails 4, 5, and 6 - inside Docker containers without Selenium - to run end-to-end tests. Now, with Rails 7.2, the same tests fail because Capybara, ...
Nellinux's user avatar

1
2 3 4 5
366