test/lib/vedeu/terminal_test.rb in vedeu-0.5.0 vs test/lib/vedeu/terminal_test.rb in vedeu-0.5.1

- old
+ new

@@ -5,14 +5,14 @@ describe Terminal do let(:described) { Vedeu::Terminal } let(:console) { IO.console } - before do + before { 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(InvalidSyntax) } end @@ -45,27 +45,27 @@ context 'when the terminal is in cooked mode' do let(:mode) { :cooked } let(:input) { "Some input\r\n" } - before do + before { 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 do + before { 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