...to use Edge Rider for new projects, which is being actively maintained and has test coverage for all versions of Rails...

...display the video. When you deliver your youtube video via https://youtu.be/jyElDp98HdI your test which checks that the embeded video is rendered in the view will fail because your...

...test server doesn't use https Solution Let your links look like //youtu.be/jyElDp98HdI and you will be fine, server side and test side...

...that have not been updated in a while Update a single gem conservatively Run tests Deal with the pain Update the next gem It's also advisable to only update...

Then I should see a table with exactly the following rows: ... Testing tables with colspan or rowspan Cucumber tables are required to have the same number of...

...cells in every row. This is unfortunate when testing a table that uses colspan or rowspan attributes. The attached step definition offers a workaround for this: Wrap the entire table...

In Paperclip you can use the validates_attachment_file_name macro to test the suffix of a filename: class User < ActiveRecord::Base has_attached_file :avatar validates_attachment...

...this prior art when implementing yours? Checklist: I confirm my design implementation has been tested manually by me adheres to the code style of the project (e.g. BEM) avoids "magic...

...navigates through elements in order (or in an order that makes sense). You can test that by clicking into the page, top/left of the new design, and repeatedly pressing the...

...override frontend.yml. Put your I18n config into application.rb, not per-environment, or dev and test see different strings than production...

makandra dev

...simple. This way, you can also mock the LLM calls in local and CI tests. See also How to add RAG to your Rails application: vector search end-to-end...

makandra dev

...pages with body text. Pages with scattered content (infographics, posters) may lose relevant information. Test with representative samples. Alternative: OCR-driven strip segmentation (split instead of trim) The autocrop above...

...time and there are no indications anything would change. And even if, any automated tests would fail immediately when trying to read the wrong table name, and you could still...

github.com

...show the message "Your account is not activated yet." super && active? end end Your tests should at least cover: Signed in users are logged out on the next request once...

...column} <@ array[:expected_values]", expected_values:) end end ..and include their specs to your test suite: describe ApplicationRecord do describe '.where_array_matches!' do let!(:matching_user) { create(:user, movie...

...all the classes in a Rails project, controllers are some of the hardest to test and understand and should receive special care. It is our belief that: Controllers should be...

...for the required model Write the controller first for the required model Write the tests first for the code bad: While doing this you can for example see easier when...

github.com

...use feature detection or a polyfill when using this API, to avoid unforeseen results. // Test via a getter in the options object to see if the passive property is accessed...

...var supportsPassive = false; try { var opts = Object.defineProperty({}, 'passive', { get: function() { supportsPassive = true; } }); window.addEventListener("testPassive", null, opts); window.removeEventListener("testPassive", null, opts); } catch (e) {} // Use our detect's results. passive applied if...

When you load a with a nonce, that script can await import() additional sources from any hostname. The nonce is propagated automatically for the one purpose of importing more scripts. This is not related to strict-dynamic, which propagates nonces for any propose not limited to imports (e.g. inserting elements). Example We have a restrictive CSP that only allows nonces: Content-Security-Policy: default-src 'none'; script-src 'nonce-secret123' Our HTML loads script.js using that nonce: Our script.js imports other.js without a nonce: let other = await import('other.js') console.log("Look, script.js has imported %o", other) The import succeeds without a nonce, due to implicit nonce propagation. Why this is useful In modern build pipelines, code splitting (chunking) is implemented using dynamic imports. Nonce propagation allows us to use automatic chunking with restrictive, nonce-based CSPs without using strict-dynamic. E.g. esbuild automatically groups dynamically imported modules into chunks, and writes that chunk to disk. The compiled build has an await import('assets/chunk-NAXSMFJV.js'). There's no way to inject a nonce into that import(), but implicit nonce propagation still allows the request. Should I worry about this? It would require some truly strange code for user input to make it into an import() argument. I wouldn't lose sleep over this. Is this a browser bug? It is by design. Here are some sources: HTML Spec Section 8 (Web Application APIs) (search for "descendant script fetch options") Chromium test ensuring none propagation Firefox bug implementing nonce propagation CSP issue: Someone concerned about propagation being a vulnerability CSP issue: Proposal for import-src that went nowhere Are other CSP sources also propagated? No, only nonces. In particular host-based CSPs do not propagate trust. For example, you only allow scripts from our own host (no nonces): Content-Security-Policy: default-src 'none'; script-src 'self' Our HTML loads script.js from our own host: Our script.js imports other.js from a different host: let other = await import('https://other-host.com/other.js') This fails with a CSP violation: Executing inline script violates the following Content Security Policy directive 'script-src 'self''

...configuration.rb With this approach you have a stronger decoupling in your application: Your unit tests might use Webmock or VCR for the lib/github_client part, but your application only talks to...

...don't need any "conversion" hacks which try to replace commas with dots. Additionally, tests which control browsers with Selenium will also see point-formatted values on non-English locales...

...the number of requests for a single IP address. Bash Command awk '{ print $1}' test.log | sort | uniq --count Result 1 87.140.79.41 3 87.140.79.42 Explain awk '{ print $1}' test.log...

When filling out forms in Selenium tests, Chrome shows the (usual) bubble, asking to store those credentials. While the bubble does not interfere with tests, it is annoying when debugging...

...tests. Here are two ways to disable it: Option 1: prefs You can set profile preferences to disable the password manager like so: prefs = { 'credentials_enable_service' => false, 'profile.password_manager...

This is my configuration: # ~/.claude/notify.sh # Note: You need to `chmod +x` this #!/bin/bash # Test usage: # echo '{ "title": "foo", "message": "bar" }' | bash ~/.claude/notify.sh EDITOR_COMMAND="/snap/bin/rubymine" INPUT=$(cat)

Don't insert table rows in a Rails database migration. This will break tests that expect that database to be empty and cause you all sorts of pain.

...that, so I hope it will be fixed with a future release. The following test succeeds: context 'factories' do let(:test_case) { FactoryBot.create(:test_case) } it 'are valid' do

...test_case).to be_valid end end But when I did the same in byebug the following happened: (byebug) FactoryBot.create(:test_case) *** NameError Exception: uninitialized constant # ::TargetLimitation

...because capybara is a dependency of cucumber-rails), which will break all your tests. The fix Bundler >= 1.14 has a --conservative flag. Using the conservative flag allows bundle update GEM...