Sha256: 0b5c53e46e8f4bfb651f2ba2220686be3b419c347b6a754529ff47de0331e41f

Contents?: true

Size: 887 Bytes

Versions: 1

Compression:

Stored size: 887 Bytes

Contents

require 'spec_helper'
require 'markdo/commands/inbox_command'

module Markdo
  describe EditCommand do
    it 'edits the Markdo root in your preferred editor' do
      skip 'Shellwords not supported' unless defined?(Shellwords)

      command_support = build_command_support({
        'EDITOR' => 'aneditor',
        'MARKDO_ROOT' => 'spec/fixtures/'
      })

      expect(Kernel).to receive(:system).with('aneditor spec/fixtures/')

      EditCommand.new(command_support).run
    end

    it 'does not allow unsafe values for MARKDO_ROOT' do
      skip 'Shellwords not supported' unless defined?(Shellwords)

      command_support = build_command_support({
        'EDITOR' => 'aneditor',
        'MARKDO_ROOT' => '`ruin everything`'
      })

      expect(Kernel).to receive(:system).with('aneditor \`ruin\ everything\`')

      EditCommand.new(command_support).run
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
markdo-0.2.0 spec/lib/commands/edit_command_spec.rb