A title for your blog

Brakeman spec

Brakeman is a vulnerability scanner designed for Ruby on Rails applications. It statically analyzes Rails application code to find security issues. Adding this snippet will fail your tests if Brakeman finds any issues

Brakeman

require 'open3'

RSpec.describe 'Brakeman' do
  it 'Brakeman passes' do
    stdout, stderr, status = Open3.capture3('bundle', 'exec', 'brakeman', '-z', '-w1')
    expect(status).to be_success, [stdout, stderr].join("\n")
  end
end

Updated 2026-09-03: Split the command into seperate args

#rspec #ruby #snippets