Thursday, June 04, 2026 1:46:57 AM
> test_compact_blank_prefix_active_support.rb
# frozen_string_literal: true

require "test_helper"

class TestArrayCompactBlankPrefix < Minitest::Test
  def test_it_removes_leading_blanks
    result = [nil, "", "foo", 1, "", "bar", "", nil].compact_blank_prefix

    # It does not remove trailing blank values
    assert_equal(["foo", 1, "", "bar", "", nil], result)
  end

  def test_it_handles_empty_array
    assert_equal([], [].compact_blank_prefix)
  end

  def test_it_handles_single_item_array
    assert_equal([1], [1].compact_blank_prefix)
  end

  def test_it_handles_array_of_blanks
    assert_equal([], [nil, "", nil].compact_blank_prefix)
  end
end
All opinions represented herein are my own
- © 2024 - 2026 itsthedevman
- build 4294fb2