Sha256: 3ca5e06395a254aae98607c27c5d19a20c5d5dac4f650745a1f1a4ee62234bc1
Contents?: true
Size: 1.47 KB
Versions: 25
Compression:
Stored size: 1.47 KB
Contents
require 'spec_helper' require 'aruba/matchers/directory' require 'fileutils' RSpec.describe 'Directory Matchers' do include_context 'uses aruba API' include_context 'needs to expand paths' describe 'to_be_an_existing_directory' do let(:name) { 'test.d' } let(:path) { File.join(@aruba.current_directory, name) } context 'when directory exists' do before :each do FileUtils.mkdir_p path end it { expect(name).to be_an_existing_directory } end context 'when directory does not exist' do it { expect(name).not_to be_an_existing_directory } end end describe 'to_have_sub_directory' do let(:name) { 'test.d' } let(:path) { File.join(@aruba.current_directory, name) } let(:content) { %w(subdir.1.d subdir.2.d) } context 'when directory exists' do before :each do FileUtils.mkdir_p path end before :each do Array(content).each { |p| Dir.mkdir File.join(path, p) } end context 'when single directory' do it { expect(name).to have_sub_directory('subdir.1.d') } end context 'when multiple directories' do it { expect(name).to have_sub_directory(['subdir.1.d', 'subdir.2.d']) } end context 'when non existing directory' do it { expect(name).not_to have_sub_directory('subdir.3.d') } end end context 'when directory does not exist' do it { expect(name).not_to have_sub_directory('subdir') } end end end
Version data entries
25 entries across 25 versions & 2 rubygems