mirror of
https://github.com/tailix/libkernaux.git
synced 2024-11-13 11:04:27 -05:00
Ruby: Add specs for KernAux::File
This commit is contained in:
parent
7897e79634
commit
064cfaf16e
2 changed files with 26 additions and 9 deletions
|
@ -2,18 +2,20 @@
|
|||
|
||||
# rubocop:disable Lint/EmptyClass
|
||||
|
||||
module KernAux
|
||||
##
|
||||
# File simulator.
|
||||
#
|
||||
class File
|
||||
if defined? KernAux::File
|
||||
module KernAux
|
||||
##
|
||||
# @!method initialize(out)
|
||||
# Create a file.
|
||||
# File simulator.
|
||||
#
|
||||
# @param out [Proc] writing method
|
||||
class File
|
||||
##
|
||||
# @!method initialize(out)
|
||||
# Create a file.
|
||||
#
|
||||
# @param out [Proc] writing method
|
||||
|
||||
# @!parse [ruby]
|
||||
# @!parse [ruby]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
15
pkgs/ruby/spec/lib/kernaux/file_spec.rb
Normal file
15
pkgs/ruby/spec/lib/kernaux/file_spec.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
defined? KernAux::File and RSpec.describe KernAux::File do
|
||||
subject(:our_file) { described_class.new method :out }
|
||||
|
||||
def out(str)
|
||||
(@buffer ||= +'') << String(str)
|
||||
end
|
||||
|
||||
specify do
|
||||
expect(our_file.instance_variable_get(:@out)).to eq method :out
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue