Logo: Relish

  1. Sign in

Project: Aruba 0.11.0

Create Directory

Use the #create_directory-method to create a directory within aruba's
working directory.

require 'spec_helper'

RSpec.configure do |config|
  config.include Aruba::Api
end

RSpec.describe 'Create directory' do
  let(:directory) { 'dir.d' }
  before(:each) { create_directory(directory) }

  it { expect(directory).to be_an_existing_directory }
end
Background
Given
I use a fixture named "cli-app"
Scenarios
New directory
Given
a file named "spec/create_directory_spec.rb" with:
require 'spec_helper'

RSpec.describe 'Create directory', :type => :aruba do
  let(:directory) { 'dir.d' }
  before(:each) { create_directory(directory) }

  it { expect(directory).to be_an_existing_directory }
end
When
I run rspec
Then
the specs should all pass
Existing directory

It does not complain if a directory already exists.

Given
a file named "spec/create_directory_spec.rb" with:
require 'spec_helper'

RSpec.describe 'Create directory', :type => :aruba do
  let(:directory) { 'dir.d' }

  before(:each) { create_directory(directory) }
  before(:each) { create_directory(directory) }

  it { expect(directory).to be_an_existing_directory }
end
When
I run rspec
Then
the specs should all pass

Last published about 5 years ago by Max Meyer.