spec/ruco/application_spec.rb in ruco-0.0.14 vs spec/ruco/application_spec.rb in ruco-0.0.15

- old
+ new

@@ -7,10 +7,14 @@ def write(content) File.open(@file,'w'){|f| f.write(content) } end + def editor_part(view) + view.naive_split("\n")[1..-2].join("\n") + end + let(:app){ Ruco::Application.new(@file, :lines => 5, :columns => 10) } let(:status){ "Ruco #{Ruco::VERSION} -- spec/temp.txt \n" } let(:command){ "^W Exit" } it "renders status + editor + command" do @@ -96,9 +100,29 @@ test = 1 end app.bind :'Ctrl+q', :foo app.key(:'Ctrl+q') test.should == 1 + end + end + + describe 'indentation' do + it "does not extra-indent when pasting" do + write('') + Ruco.class_eval "Clipboard.copy('ab\n cd\n ef')" + app.key(:tab) + app.key(:tab) + app.key(:'Ctrl+v') # paste + editor_part(app.view).should == " ab\n cd\n ef" + end + + it "indents when typing" do + write('') + app.key(:tab) + app.key(:tab) + app.key(:enter) + app.key('a') + editor_part(app.view).should == " \n a\n" end end describe '.ruco.rb' do it "loads it and can use the bound keys" do \ No newline at end of file