spec/ruco/application_spec.rb in ruco-0.0.15 vs spec/ruco/application_spec.rb in ruco-0.0.16
- old
+ new
@@ -1,10 +1,12 @@
+# encoding: UTF-8
require File.expand_path('spec/spec_helper')
describe Ruco::Application do
before do
@file = 'spec/temp.txt'
+ write('')
end
def write(content)
File.open(@file,'w'){|f| f.write(content) }
end
@@ -21,11 +23,10 @@
write("xxx\nyyy\nzzz")
app.view.should == "#{status}xxx\nyyy\nzzz\n#{command}"
end
it "can enter stuff" do
- write("")
app.key('2')
app.key('2')
app.key(:enter)
app.key('2')
app.key(:enter)
@@ -68,17 +69,19 @@
end
end
describe 'go to line' do
it "goes to the line" do
+ write("\n\n\n")
app.key(:"Ctrl+g")
app.key('2')
app.key(:enter)
app.cursor.should == [2,0] # status bar + 2
end
it "goes to 1 when strange stuff entered" do
+ write("\n\n\n")
app.key(:"Ctrl+g")
app.key('0')
app.key(:enter)
app.cursor.should == [1,0] # status bar + 1
end
@@ -105,19 +108,17 @@
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"
\ No newline at end of file