Sha256: 3a908dcade88e1c00272d8fa657b4329687ddb45f64dbd449045837c75ff25ab

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Planter::FileEntry do
  subject do
    Planter::FileEntry.new(File.expand_path('spec/templates/test/test.rb'), File.expand_path('spec/test_out/test.rb'),
                           :ignore)
  end

  describe '#initialize' do
    it 'makes a new instance' do
      expect(subject).to be_a described_class
    end
  end

  describe '#to_s' do
    it 'returns the name of the file' do
      expect(subject.to_s).to be_a(String)
    end
  end

  describe '#inspect' do
    it 'returns a string representation of the file' do
      expect(subject.inspect).to be_a(String)
    end
  end

  describe '#ask_operation' do
    it 'returns :copy' do
      expect(subject.ask_operation).to eq(:copy)
    end

    it 'returns :ignore for existing file' do
      fileentry = Planter::FileEntry.new(File.expand_path('spec/templates/test/test.rb'), File.expand_path('spec/test_out/test2.rb'),
                                         :ignore)
      expect(fileentry.ask_operation).to eq(:ignore)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
planter-cli-3.0.7 spec/planter/file_entry_spec.rb
planter-cli-3.0.5 spec/planter/file_entry_spec.rb
planter-cli-3.0.4 spec/planter/file_entry_spec.rb
planter-cli-3.0.3 spec/planter/file_entry_spec.rb
planter-cli-3.0.2 spec/planter/file_entry_spec.rb
planter-cli-3.0.1 spec/planter/file_entry_spec.rb
planter-cli-0.0.4 spec/planter/file_entry_spec.rb