File: blank_spec.rb

package info (click to toggle)
ruby-powerpack 0.1.1-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 492 kB
  • sloc: ruby: 819; makefile: 3
file content (17 lines) | stat: -rw-r--r-- 431 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require 'spec_helper'

unless String.method_defined? :blank?
  describe 'String#blank?' do
    it 'returns true for an empty string' do
      expect(''.blank?).to be_truthy
    end

    it 'returns true for a string with only whitespace in it' do
      expect('     '.blank?).to be_truthy
    end

    it 'returns false for a string with non-whitespace chars in it' do
      expect('   test'.blank?).to be_falsey
    end
  end
end