File: format_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 (14 lines) | stat: -rw-r--r-- 362 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
require 'spec_helper'

unless String.method_defined? :format
  describe 'String#format' do
    it 'behaves like String#%' do
      expect('%s %s'.format %w(James Bond)).to eq('%s %s' % %w(James Bond))
    end

    it 'behaves like Kernel#sprintf' do
      expect('%s %s'.format %w(James Bond))
        .to eq(sprintf('%s %s', 'James', 'Bond'))
    end
  end
end