test/lib/vedeu/terminal_test.rb in vedeu-0.5.6 vs test/lib/vedeu/terminal_test.rb in vedeu-0.5.7

- old
+ new

@@ -5,14 +5,14 @@ describe Terminal do let(:described) { Vedeu::Terminal } let(:console) { IO.console } - before { + before do console.stubs(:winsize).returns([25, 80]) console.stubs(:print) - } + end describe '.open' do context 'when a block was not given' do it { proc { Terminal.open }.must_raise(Vedeu::InvalidSyntax) } end @@ -45,28 +45,28 @@ context 'when the terminal is in cooked mode' do let(:mode) { :cooked } let(:input) { "Some input\r\n" } - before { + before do Terminal.stubs(:mode).returns(mode) console.stubs(:gets).returns(input) - } + end it { subject.must_equal('Some input') } end context 'when the terminal is in raw mode' do let(:mode) { :raw } let(:input) { "\e" } - before { + before do Terminal.stubs(:mode).returns(mode) console.stubs(:getch).returns(input) input.stubs(:ord).returns(27) console.stubs(:read_nonblock) - } + end it { subject.must_be_instance_of(String) } end end @@ -162,24 +162,21 @@ describe '.origin' do subject { Terminal.origin } it { subject.must_be_instance_of(Fixnum) } - it { subject.must_equal(1) } - it { described.must_respond_to(:x) } it { described.must_respond_to(:y) } it { described.must_respond_to(:tx) } it { described.must_respond_to(:ty) } end describe '.width' do subject { Terminal.width } it { subject.must_be_instance_of(Fixnum) } - it { described.must_respond_to(:xn) } it { described.must_respond_to(:txn) } context 'via method' do it 'returns the width' do @@ -196,10 +193,9 @@ describe '.height' do subject { Terminal.height } it { subject.must_be_instance_of(Fixnum) } - it { described.must_respond_to(:yn) } it { described.must_respond_to(:tyn) } context 'via method' do it 'returns the height' do