Sha256: 8bfc36f46f82269b3ac0baea2e438c19654821de3477121016e271275169d553

Contents?: true

Size: 1.33 KB

Versions: 59

Compression:

Stored size: 1.33 KB

Contents

require 'test_helper'

module Vedeu

  module Editor

    describe Capture do

      let(:described) { Vedeu::Editor::Capture }
      let(:instance)  { described.new(console) }
      let(:console)   { mock }

      describe '#initialize' do
        it { instance.must_be_instance_of(described) }
        it { instance.instance_variable_get('@console').must_equal(console) }
      end

      describe '.read' do
        subject { described.read(console) }

        before do
          Vedeu::Terminal.stubs(:console).returns(console)
          console.stubs(:getch).returns(keys)
        end

        context 'when nothing is given' do
          let(:keys) { nil }
        end

        context 'when a single keypress is given' do
          let(:keys) { 'a' }

          it { subject.must_equal('a') }
        end

        context 'when a ctrl+keypress is given' do
          let(:keys) { "\u0001" }

          it { subject.must_equal(:ctrl_a) }
        end

        context 'when a shift+keypress is given' do
          let(:keys) { 'A' }

          it { subject.must_equal('A') }
        end

        context 'when a alt+keypress is given' do
        end

        context 'when a super+keypress is given' do
        end
      end

      describe '#read' do
        it { instance.must_respond_to(:read) }
      end

    end # Capture

  end # Editor

end # Vedeu

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
vedeu-0.6.18 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.17 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.16 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.15 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.14 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.13 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.12 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.11 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.10 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.9 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.8 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.7 test/lib/vedeu/input/editor/capture_test.rb
vedeu-0.6.6 test/lib/vedeu/input/editor/capture_test.rb
vedeu-0.6.5 test/lib/vedeu/input/editor/capture_test.rb
vedeu-0.6.4 test/lib/vedeu/input/editor/capture_test.rb
vedeu-0.6.3 test/lib/vedeu/input/editor/capture_test.rb
vedeu-0.6.2 test/lib/vedeu/input/editor/capture_test.rb
vedeu-0.6.1 test/lib/vedeu/input/editor/capture_test.rb
vedeu-0.6.0 test/lib/vedeu/input/capture_test.rb