Sha256: 6a015a9bd74c4ce7deff75feb829b01bf5a11b76759ed7a3bd123722b1ffbfc5

Contents?: true

Size: 983 Bytes

Versions: 10

Compression:

Stored size: 983 Bytes

Contents

require 'spec_helper'
require 'gemirro/mirror_directory'
require 'gemirro/mirror_file'

# MirrorDirectory tests
module Gemirro
  describe 'MirrorDirectory' do
    include FakeFS::SpecHelpers

    before(:each) do
      @mirror_directory = MirrorDirectory.new('./')
    end

    it 'should be initialized' do
      expect(@mirror_directory.path).to eq('./')
    end

    it 'should add directory' do
      expect(@mirror_directory.add_directory('test/test2'))
        .to be_a(MirrorDirectory)
      expect(File.directory?('./test/test2')).to be_truthy
    end

    it 'should add file' do
      result = @mirror_directory.add_file('file', 'content')
      expect(result).to be_a(MirrorFile)
      expect(result.read).to eq('content')
    end

    it 'should test if file exists' do
      expect(@mirror_directory.file_exists?('test')).to be_falsy
      @mirror_directory.add_file('test', 'content')
      expect(@mirror_directory.file_exists?('test')).to be_truthy
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
gemirro-1.5.0 spec/gemirro/mirror_directory_spec.rb
gemirro-1.4.0 spec/gemirro/mirror_directory_spec.rb
gemirro-1.3.0 spec/gemirro/mirror_directory_spec.rb
gemirro-1.2.0 spec/gemirro/mirror_directory_spec.rb
gemirro-1.1.1 spec/gemirro/mirror_directory_spec.rb
gemirro-1.1.0 spec/gemirro/mirror_directory_spec.rb
gemirro-1.0.0 spec/gemirro/mirror_directory_spec.rb
gemirro-0.16.0 spec/gemirro/mirror_directory_spec.rb
gemirro-0.15.0 spec/gemirro/mirror_directory_spec.rb
gemirro-0.14.0 spec/gemirro/mirror_directory_spec.rb