Sha256: 56648757e63706a04ae65fd8aa7ed85f9d8f493d7a050c71e6dbfc2e74d1886b

Contents?: true

Size: 996 Bytes

Versions: 1

Compression:

Stored size: 996 Bytes

Contents

require 'spec_helper'

describe RobotVim::ScriptFile do
  describe "when creating a script file from a string" do
    let(:commands_string){"some string of vim commands"}

    it "yields the path of the script file" do
      expected_path = "/some/path/somewhere"
      UUID.stub_chain(:new, :generate => expected_path)
      file = stub("file").as_null_object
      File.stub(:new).and_return(file)

      RobotVim::ScriptFile.open(commands_string) do |file_path|
        file_path.should == expected_path
      end
    end

    it "writes the commands out to the script file" do
      RobotVim::ScriptFile.open(commands_string) do |file_path|
        File.read(file_path).should == commands_string
      end
    end

    it "deletes the file after we are done using it" do
      file_name = "somefile" 
      UUID.stub_chain(:new, :generate => file_name)
      RobotVim::ScriptFile.open(commands_string) do |file_path|
      end
      File.exists?(file_name).should be_false
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
robot-vim-0.9.0 spec/robot-vim/script_file_spec.rb