Switching the "main" context This will change the "default receiver" of expressions. Can be used to simulate a "debugger situation...
In FactoryBot factories, Rails' file_fixture is not available by default. To enable it, include a support module from rspec...
Updated most aspects of this card.
Some key highlights and points from the linked article TestProf II: Factory therapy for your Ruby tests. The Problem with...
Rails slightly changed the fragment cache implementation from Rails 7.0 to Rails 7.1. Unfortunately, this is incompatible with how Haml...
Text fragments allow linking directly to a specific portion of text in a web document, without requiring the author to...
Rails' fragment caching caches subtrees of an HTML document tree. While constructing that tree though, it can be really hard...
Slow test suites are a major pain point in projects, often due to RSpec and FactoryBot. Although minitest and fixtures...
Starting with ChromeDriver 127, if your application displays a beforeunload confirmation dialog, ChromeDriver will immediately close it. In consequence, any...
I recently stumbled upon the Rails feature composed_of. One of our applications dealt with a lot of addresses and...
Whenever you have to deal with randomness in a jasmine test there are some spy strategies to help you out...
I was recently asked to optimize the response time of a notoriously slow JSON API endpoint that was backed by...
ActiveModel classes have a class method .human_attribute_name. This returns a human-readable form of the attribute: Person.human_attribute...
In Rails 7.1 it has become possible to annotate partials with the locals they expect: # partial _user_name.erb <%# locals: (user:) %>
If an view spec crashes due to undefined helper methods, you can enable this option: # config/application.rb config.action_controller.include_all_helpers = true...
Your commit messages should include the ID of the issue your code belongs to. Our preferred syntax prefixes the issue...
This card describes two variants, that add a more intuitive workflow when working with nested attributes in Rails + Unpoly.
This card describes different flavors for concatting HTML safe strings in a helper method in Rails. You might want to...
...HTML elements can automatically start playing when the autoplay attribute is set on them. Except for when they can not...
Debugging performance issues in your Rails app can be a tough challenge. To get more detailed insights consider using the...
Note Using rem only ever makes sense when the root font size is dynamic, i.e. you leave control to the...
If you are using git submodules in Gitlab CI, you might run into a "The project you were looking for...
tl;dr Prefer request specs over end-to-end tests (Capybara) to joyfully test file downloads! Why? Testing file downloads
A common cause of non-accessible web pages are elements that were made interactive via JavaScript but cannot be focused...