spec/ruco/application_spec.rb in ruco-0.0.7 vs spec/ruco/application_spec.rb in ruco-0.0.8

- old
+ new

@@ -8,11 +8,11 @@ def write(content) File.open(@file,'w'){|f| f.write(content) } end let(:app){ Ruco::Application.new(@file, :lines => 5, :columns => 10) } - let(:status){ "Ruco 0.0.6 -- spec/temp.txt \n" } + let(:status){ "Ruco #{Ruco::VERSION} -- spec/temp.txt \n" } let(:command){ "^W Exit" } it "renders status + editor + command" do write("xxx\nyyy\nzzz") app.view.should == "#{status}xxx\nyyy\nzzz\n#{command}" @@ -33,7 +33,33 @@ app.key(:"Ctrl+g") # go to line app.key(50) # 2 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 + end + + describe :bind do + it "can execute bound stuff" do + test = 0 + app.bind :'Ctrl+q' do + test = 1 + end + app.key(:'Ctrl+q') + test.should == 1 + end + + it "can execute an action via bind" do + test = 0 + app.action :foo do + test = 1 + end + app.bind :'Ctrl+q', :foo + app.key(:'Ctrl+q') + test.should == 1 + end end end \ No newline at end of file