Sha256: 2a77d2f1e7b6430d4ba30b8a692c0278fac7fc8af81854b54e976a94044119f9

Contents?: true

Size: 608 Bytes

Versions: 1

Compression:

Stored size: 608 Bytes

Contents

require 'spec_helper'

describe "Automating Vim with RobotVim" do
  it "can sort a file using vim" do
    input_path = File.join(File.dirname(__FILE__), "fixtures", "unsorted_file.txt")
    unsorted_text = File.read(input_path)

    output_file = "output.txt"

    commands = <<-COMMANDS
      :%!sort
      :w #{output_file}
      :%bd!
      :q!
    COMMANDS

    runner = RobotVim::Runner.new
    runner.run(:commands => commands, :input_file => input_path)
    result = File.read(output_file)
    result.should eql(unsorted_text.split("\n").sort.join("\n") + "\n")
    File.delete(output_file)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
robot-vim-0.1.1 spec/integration_spec.rb