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.59 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.58 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.57 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.56 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.54 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.53 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.52 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.51 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.50 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.49 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.48 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.47 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.46 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.45 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.44 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.43 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.42 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.41 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.40 test/lib/vedeu/editor/capture_test.rb
vedeu-0.6.39 test/lib/vedeu/editor/capture_test.rb