module CoreExtensions
  module Array
    # Asserts that the array contains one single element, and returns that element
    def assert_and_return_first_element
      number_of_elements = count
      fail "Found #{number_of_elements} elements!" unless number_of_elements == 1
      self[0]
    end
  end
end
