RSpec: Ensuring a method is called on an object that will be created in the future

RSpec’s and_wrap_original can attach expectations to objects created during a call, making it easier to verify the right validator instance without relying on expect_any_instance_of.

Rails: Using custom config files with the config_for method

Global Rails settings can live in YAML files with environment-specific overrides via config_for, avoiding constant collisions and supporting fetch or bang accessors.

Continuous Security Testing with Devops - OWASP EU 2014

Automated security testing integrated into a BDD workflow reduces gaps between development and security review for teams shipping software continuously.

has_many :bugs, :through => :rails: Make your shoulda tests faster with fast_context

decided to go fixtureless with Shoulda + Factory Girl. All good, except one problem. Slow as fuck tests. So here’s fast_context as a solution for it. fast_context compiles all the ‘should’s within a context into a single test.

Gatekeeping: Guide for gatekeeper

Project code is reviewed before staging to catch client rejections early and keep changes maintainable. Gatekeepers approve or reject merge requests and decide whether a review is needed.

RSpec: Scoping custom matchers to example groups

Custom RSpec matchers can stay local to one example group or selected groups, avoiding global helper pollution while reusing expectation logic.

babushka: test-driven sysadmin

The idea is this: you take a job that you'd rather not do manually, and describe it to babushka using its DSL. The way it works, babushka not only knows how to accomplish each part of the job, it also knows how to check if each part is already done. You're teaching babushka to achieve an end goal with whatever runtime conditions you throw at it, not just to perform the task that would get you there from the very start.

Waiting for page loads and AJAX requests to finish with Capybara

Capybara browser tests can fail while page loads or AJAX requests are still pending; waiting for visible results reduces flickering and unreliable assertions.

Rails: Flagging all cookies as secure-only to pass a security audit

Secure cookies are often required by audits even when a Rails app already uses HTTPS and HSTS. A middleware can add the Secure flag to server-set cookies automatically.

Reflective Surface » Tests: Pragmatism or ideology?

The argument that using tests is a ideologic waster of time fails when one considers how it can help to insure architectural decisions.

Should I test for translated strings?

I brought up the question whether tests should call the translation API when checking for the presence of a string.

Alex Miller - Unit tests are a drop cloth

Unit tests are to refactoring like a drop cloth is to painting. Both feel like more work at first but ultimately save you time by allowing you to move faster.

How to test a confirm dialog with Cucumber? - Stack Overflow

Seems like there's no way to do it in Capybara, unfortunately. But if you're running your tests with the Selenium driver (and probably other drivers that support JavaScript), you can hack it

SAML Single Logout (SLO)

SAML logout can be initiated by the service provider or identity provider, with browser redirects or backchannel POSTs; devise_saml_authenticatable needs specific Rails and Keycloak logout handling.

How to: Benchmark an Active Record query with a Ruby script

Benchmarking Active Record queries needs repeated runs and cache clearing to measure realistic PostgreSQL performance; a Ruby script can report percentile timings.

RSpec: Leverage the power of Capybara Finders and Matchers for view specs

View specs can stay fast and readable by querying rendered HTML with Capybara finders and matchers instead of relying on heavier request or feature specs.

RSpec: Composing a custom matcher from existing matchers

Compose a custom RSpec matcher from existing matchers to reduce repeated expectations and keep failure messages informative.

Gatekeeping: Guide for developer

Developer workflow for review-gated changes in Linear and GitLab, with branch, merge, reject, and staging steps to reduce client rejections.

How to push to Git without running CI on GitLab CI, GitHub Actions, or Travis CI

Git pushes can trigger unwanted CI jobs on GitLab, GitHub Actions, or Travis CI. Skip runs with commit-message flags or GitLab push options.

Pitfall: ActiveRecord callbacks: Method call with multiple conditions

Conditional after_save callbacks can silently lose earlier :if conditions when the same method is registered twice. Combine predicates or move the logic into the callback.

Configuring ActionMailer host and protocol for URL generation

ActionMailer URL generation fails without a configured host and protocol. Rails can use hardcoded defaults or derive them from the request for mailers sent outside the request cycle.

How to simulate limited bandwidth in Google Chrome and Firefox

Slow network conditions can be reproduced for web app testing with browser devtools or trickle, revealing issues on mobile and other constrained connections.

Using the Truemail gem to validate e-mail addresses

Email address validation can catch invalid sign-ups before they reach your app. Truemail offers regex, MX, and SMTP checks, with MX as the practical middle ground.

RubyMine: Find and Replace with Regex (Capture Groups and Backreferences)

Regex find-and-replace in RubyMine uses capture groups and backreferences to rewrite quoted text, URLs, and old RSpec syntax safely.