spec/ruco/application_spec.rb in ruco-0.1.5 vs spec/ruco/application_spec.rb in ruco-0.1.6

- old
+ new

@@ -29,16 +29,16 @@ def type(*keys) keys.each{|k| app.key k } end def status(line=1) - "Ruco #{Ruco::VERSION} -- spec/temp.txt #{line}:1\n" + "Ruco #{Ruco::VERSION} -- spec/temp.txt #{line}:1\n" end let(:rucorc){ 'spec/.ruco.rb' } - let(:app){ Ruco::Application.new(@file, :lines => 5, :columns => 10, :rc => rucorc) } - let(:command){ "^W Exit" } + let(:app){ Ruco::Application.new(@file, :lines => 5, :columns => 50, :rc => rucorc) } + let(:command){ "^W Exit ^S Save ^F Find ^R Replace" } it "renders status + editor + command" do write("xxx\nyyy\nzzz") app.view.should == "#{status}xxx\nyyy\nzzz\n#{command}" end @@ -67,11 +67,11 @@ end it "can resize" do write("01234567\n1\n2\n3\n4\n5678910111213\n6\n7\n8") app.resize(8, 7) - app.view.should == "#{status}0123456\n1\n2\n3\n4\n5678910\n#{command}" + app.view.should == "Ruc 1:1\n0123456\n1\n2\n3\n4\n5678910\n^W Exit" end describe 'opening with line' do before do write("\n1\n2\n3\n4\n5\n") @@ -183,51 +183,51 @@ it "can find and replace multiple times" do write 'xabac' type :"Ctrl+r", 'a', :enter app.view.should include("Replace with:") type 'd', :enter - app.view.should include("Replace") + app.view.should include("Replace=Enter") type :enter # replace first - app.view.should include("Replace") + app.view.should include("Replace=Enter") type :enter # replace second -> finished - app.view.should_not include("Replace") + app.view.should_not include("Replace=Enter") editor_part(app.view).should == "xdbdc\n\n" end it "can find and skip replace multiple times" do write 'xabac' type :"Ctrl+r", 'a', :enter app.view.should include("Replace with:") type 'd', :enter - app.view.should include("Replace") + app.view.should include("Replace=Enter") type 's', :enter # skip - app.view.should include("Replace") + app.view.should include("Replace=Enter") type 's', :enter # skip - app.view.should_not include("Replace") + app.view.should_not include("Replace=Enter") editor_part(app.view).should == "xabac\n\n" end it "can replace all" do write '_a_a_a_a' type :"Ctrl+r", 'a', :enter app.view.should include("Replace with:") type 'd', :enter - app.view.should include("Replace") + app.view.should include("Replace=Enter") type 's', :enter # skip first - app.view.should include("Replace") + app.view.should include("Replace=Enter") type 'a', :enter # all - app.view.should_not include("Replace") + app.view.should_not include("Replace=Enter") editor_part(app.view).should == "_a_d_d_d\n\n" end it "breaks if neither s nor enter is entered" do write 'xabac' type :"Ctrl+r", 'a', :enter app.view.should include("Replace with:") type "d", :enter - app.view.should include("Replace") + app.view.should include("Replace=Enter") type 'x', :enter - app.view.should_not include("Replace") + app.view.should_not include("Replace=Enter") editor_part(app.view).should == "xabac\n\n" end it "reuses find" do write 'xabac'