File: output_spec.rb

package info (click to toggle)
ruby-fuubar 2.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 504 kB
  • sloc: ruby: 377; sh: 29; makefile: 7
file content (36 lines) | stat: -rw-r--r-- 621 bytes parent folder | download
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