Sha256: 1678d7f6f69ce4f7d34c8e640a2be61dfc2ab56c87b62a2e7144295224131b63

Contents?: true

Size: 1.55 KB

Versions: 14

Compression:

Stored size: 1.55 KB

Contents

require 'test_helper'

module Vedeu

	describe TerminalMode do

    let(:described) { Vedeu::TerminalMode }

    describe '.raw_mode?' do
      subject { described.raw_mode? }

      it 'returns true if the terminal is in raw mode' do
        described.raw_mode!
        subject.must_equal(true)
      end

      it 'returns false if the terminal is not in raw mode' do
        described.cooked_mode!
        subject.must_equal(false)
      end
    end

    describe '.cooked_mode?' do
      subject { described.cooked_mode? }

      it 'returns true if the terminal is in cooked mode' do
        described.cooked_mode!
        subject.must_equal(true)
      end

      it 'returns false if the terminal is not in cooked mode' do
        described.raw_mode!
        subject.must_equal(false)
      end
    end

    describe '.switch_mode!' do
      subject { described.switch_mode! }

      it 'returns a Symbol' do
        subject.must_be_instance_of(Symbol)
      end

      it 'returns :cooked if previously :raw' do
        described.raw_mode!
        subject.must_equal(:cooked)
      end

      it 'returns :raw if previously :cooked' do
        described.cooked_mode!
        subject.must_equal(:raw)
      end
    end

    describe '.mode' do
      subject { described.mode }

      before do
        described.raw_mode!
        Configuration.stubs(:terminal_mode).returns(:raw)
      end

      it { subject.must_be_instance_of(Symbol) }

      it 'returns the configured terminal mode' do
        subject.must_equal(:raw)
      end
    end

	end # TerminalMode

end # Vedeu

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
vedeu-0.5.11 test/lib/vedeu/terminal_mode_test.rb
vedeu-0.5.10 test/lib/vedeu/terminal_mode_test.rb
vedeu-0.5.9 test/lib/vedeu/terminal_mode_test.rb
vedeu-0.5.8 test/lib/vedeu/terminal_mode_test.rb
vedeu-0.5.7 test/lib/vedeu/terminal_mode_test.rb
vedeu-0.5.0 test/lib/vedeu/terminal_mode_test.rb
vedeu-0.4.65 test/lib/vedeu/terminal_mode_test.rb
vedeu-0.4.64 test/lib/vedeu/terminal_mode_test.rb
vedeu-0.4.63 test/lib/vedeu/terminal_mode_test.rb
vedeu-0.4.62 test/lib/vedeu/terminal_mode_test.rb
vedeu-0.4.61 test/lib/vedeu/terminal_mode_test.rb
vedeu-0.4.60 test/lib/vedeu/terminal_mode_test.rb
vedeu-0.4.59 test/lib/vedeu/terminal_mode_test.rb
vedeu-0.4.58 test/lib/vedeu/terminal_mode_test.rb