Sha256: fe2776c7bec2a059dcbc8924beab38b4ee8cd5bfe1f4a925614aba742197ff89

Contents?: true

Size: 1018 Bytes

Versions: 4

Compression:

Stored size: 1018 Bytes

Contents

require 'spec_helper'
require 'warp/dir/formatter'

RSpec.describe Warp::Dir::Command::List do

  let(:commander) { Warp::Dir.commander }
  let(:list) { Warp::Dir::Command::List }

  describe '#help' do
    it 'should define a help message' do
      expect(list.help).to match /list/
      expect(list.help).to match /Print all stored warp points/
    end
  end

  describe '#run' do
    include_context :fake_serializer
    include_context :initialized_store

    let(:formatter) { Warp::Dir::Formatter.new(store) }
    let(:output) { formatter.format_store(:ascii) }
    before do
      store.add(point: point)
    end

    it 'should return formatted warp points from the store' do
      expect(output).to eql(%Q{harro  ->  ~/workspace/tinker-mania})
    end

    it 'should return response and print the listing' do
      response = list.new(store).run
      expect(response.messages.first).to eql(output.blue.bold)
      expect(STDOUT).to receive(:printf).at_least(1).times
      response.print
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
warp-dir-1.1.3 spec/warp/dir/commands/list_spec.rb
warp-dir-1.1.2 spec/warp/dir/commands/list_spec.rb
warp-dir-1.1.1 spec/warp/dir/commands/list_spec.rb
warp-dir-1.1.0 spec/warp/dir/commands/list_spec.rb