1
0
Fork 0
mirror of https://github.com/tailix/libkernaux.git synced 2024-11-13 11:04:27 -05:00
libkernaux/pkgs/ruby/spec/lib/kernaux/sprintf1_spec.rb

26 lines
708 B
Ruby

# frozen_string_literal: true
require 'spec_helper'
RSpec.describe KernAux, '.sprintf1' do
context 'with 1 argument' do
subject(:sprintf1) { described_class.sprintf1 format }
let(:format) { '%%' }
it { is_expected.to be_instance_of String }
it { is_expected.to be_frozen }
it { is_expected.to eq described_class.snprintf1(1000, format).first }
end
context 'with 2 argument' do
subject(:sprintf1) { described_class.sprintf1 format, arg }
let(:format) { '%s' }
let(:arg) { 'Hello, World!' }
it { is_expected.to be_instance_of String }
it { is_expected.to be_frozen }
it { is_expected.to eq described_class.snprintf1(1000, format, arg).first }
end
end