1,567 questions
0
votes
1
answer
47
views
Assertions for travel_to with attribute-based timezone
At 10 a.m. an object becomes active and visible to the user.
seconds_since_midnight.to_i at 10:00 is 36000, but that is not timezone aware.
application_controller sets a tenant and its timezone, based ...
0
votes
0
answers
57
views
Properly submitting array of data for a minitest
The following params are submitted in different actions the following manner
?acc_ids%5B%5D=246&acc_ids%5B%5D=247&acc_ids%5B%5D=248 with Parameters: {"acc_ids"=>["246", &...
1
vote
1
answer
46
views
How to turn on 'Click to see difference' RubyMine pop up window to compare JSON in test runner
I am using minitest for testing in RubyMine and want to work out how to turn on the 'Click to see difference' comparison window for failed tests so that I can read JSON more easily.
In the past I ...
0
votes
1
answer
26
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.
0
votes
2
answers
174
views
webmock syntax for return hash
Webmock provides a suggested stub for a Rails controller action.
I have not found proper syntax required for the return body.
The request (abbreviated)
intent = Stripe::PaymentIntent.create({
amount:...
0
votes
0
answers
47
views
Running single MiniTest in single file
I'm trying figure out how to run a single test within a single file in MiniTest. Here's the directory structure:
Here's the content of Rakefile:
require 'minitest/test_task'
Minitest::TestTask....
0
votes
1
answer
55
views
Ruby: flip between require and require_relative in minitests
I'm working on a Ruby gem. I'm writing unit tests for it in minitest.
Currently I'm using require_relative 'lib/my_gem' to load the gem scripts for test purposes.
Eventually I'll be publishing the gem ...
0
votes
0
answers
102
views
ruby minitest puts() sometimes works, sometimes doesn't
I have a series of minitests that work just fine
Ubuntu 22.04.2 Ruby ruby 3.2.3 minitest:4.25.4 rake:13.2.1
These are being kicked off with rake:
bundle exec rake test $@
# rakefile:
require 'rake/...
1
vote
2
answers
147
views
Should I write a test for each required attribute in a Rails model or is one enough? [closed]
I'm working on a Ruby on Rails project and practicing Test-Driven Development (TDD) using Minitest.
For user authentication (using Devise), I wrote a test to check that a user cannot sign up without ...
-1
votes
1
answer
133
views
How would I test Ruby or Rails constants using minitest?
I believe all end-developer code (including constants) should be tested (as mentioned here). I'm not looking for a debate on that.
Assume I have these Ruby and/or Rails constants that I'd like to test ...
0
votes
1
answer
51
views
Selenium-webdriver: Process.spawn can't see existing /root/.webdrivers/chromedriver
Creating my first Selenium test, I get the following excpetion
Error:
LoginsTest#...
1
vote
3
answers
433
views
Why does SimpleCov generate a coverage report before running tests?
I'm trying to build a Ruby gem. I set up a development environment using a Docker image based on Ruby 3.3 and a devcontainer.
I initialized a gem using the bundle gem tooling. This set up the basic ...
2
votes
1
answer
496
views
Testing broadcasts_refreshes in Rails
Can I test broadcasts_refreshes in my ActiveJob tests? Or maybe in my model tests? Is there another place where I should be testing this?
According to the Broadcastable docs (my emphasis added):
...
0
votes
1
answer
67
views
Rails minitest + authlogic cannot authenticate
I am following the authlogic setup for authenticating an admin user during testing setup using minitest ( https://github.com/binarylogic/authlogic/blob/master/lib/authlogic/test_case.rb ). It seems ...
1
vote
3
answers
104
views
ISO 8061 built-in support in RSpec or Minitest
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)> ...