1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
# frozen_string_literal: true
require 'fuubar'
class TestNonTtyOutputClass
def tty?
false
end
end
class TestTtyOutputClass
def hello
'hello'
end
def tty?
true
end
end
class Fuubar < ::RSpec::Core::Formatters::BaseTextFormatter
describe Output do
it 'delegates anything to the passed in object' do
output = Output.new(::TestTtyOutputClass.new)
expect(output.hello).to eql 'hello'
expect(output).to be_tty
end
it 'can override the TTY of the passed in class' do
output = Output.new(::TestNonTtyOutputClass.new, true)
expect(output).to be_tty
end
end
end
|