Sha256: 281a0d26ccf0f497bd3733acbeaa15dc70c9fa79d1854374e0a831b7e65cdf21
Contents?: true
Size: 930 Bytes
Versions: 2
Compression:
Stored size: 930 Bytes
Contents
# frozen_string_literal: true RSpec.describe TTY::Editor, '#command' do it 'escapes editor filename on Unix' do filename = "/usr/bin/hello world.rb" allow(::FileTest).to receive(:file?).with(filename).and_return(true) allow(::File).to receive(:exist?).with(filename).and_return(true) allow(TTY::Editor).to receive(:windows?).and_return(false) editor = TTY::Editor.new(filename, command: :vim) expect(editor.command_path).to eql("vim /usr/bin/hello\\ world.rb") end it "escapes path separators on Windows" do filename = 'C:\User\hello world.rb' allow(::FileTest).to receive(:file?).with(filename).and_return(true) allow(::File).to receive(:exist?).with(filename).and_return(true) allow(TTY::Editor).to receive(:windows?).and_return(true) editor = TTY::Editor.new(filename, command: :vim) expect(editor.command_path).to eql("vim C:\\\\User\\\\hello\\ world.rb") end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tty-editor-0.5.1 | spec/unit/command_path_spec.rb |
tty-editor-0.5.0 | spec/unit/command_path_spec.rb |