spec/ruco/application_spec.rb in ruco-0.0.9 vs spec/ruco/application_spec.rb in ruco-0.0.10

- old
+ new

@@ -35,12 +35,29 @@ app.key(:enter) app.view.should == "#{status}123\n456\n789\n#{command}" app.cursor.should == [3,0] # 0 offset + 1 for statusbar end - it "can quit" do - result = app.key(:"Ctrl+w") - result.should == :quit + describe 'closing' do + it "can quit" do + result = app.key(:"Ctrl+w") + result.should == :quit + end + + it "asks before closing changed file -- escape == no" do + app.key(?a) + app.key(:"Ctrl+w") + app.view.split("\n").last.should include("Loose changes") + app.key(:escape).should_not == :quit + app.key("\n").should_not == :quit + end + + it "asks before closing changed file -- enter == yes" do + app.key(?a) + app.key(:"Ctrl+w") + app.view.split("\n").last.should include("Loose changes") + app.key(:enter).should == :quit + end end describe :bind do it "can execute bound stuff" do test = 0 \ No newline at end of file