Sha256: decd6aa45b21e1ace8469d79094c09ba1eaf682791557fad999d22840376c78e
Contents?: true
Size: 1.65 KB
Versions: 1
Compression:
Stored size: 1.65 KB
Contents
Feature: Check existence of files and directories Use the `#exist?` to check if a path exists within `aruba`'s working directory. , May also want to look for `#file?` or `#directory?` for some more specific tests. ```ruby require 'spec_helper' RSpec.configure do |config| config.include Aruba::Api end RSpec.describe 'Check if directory and file exist' do let(:directory) { 'dir.d' } let(:file) { 'file.txt' } before(:each) { create_directory(directory) } before(:each) { touch(file) } it { expect(exist?(directory)).to be true } it { expect(exist?(file)).to be true } end ``` Background: Given I use a fixture named "cli-app" Scenario: Is file or directory and exists Given a file named "spec/create_directory_spec.rb" with: """ require 'spec_helper' RSpec.describe 'Check if directory and file exist', :type => :aruba do let(:directory) { 'dir.d' } let(:file) { 'file.txt' } before(:each) { create_directory(directory) } before(:each) { touch(file) } it { expect(exist?(directory)).to be true } it { expect(exist?(file)).to be true } end """ When I run `rspec` Then the specs should all pass Scenario: Is file or directory and does not exist Given a file named "spec/create_directory_spec.rb" with: """ require 'spec_helper' RSpec.describe 'Check if directory and file exist', :type => :aruba do let(:directory) { 'dir.d' } let(:file) { 'file.txt' } it { expect(exist?(directory)).to be false } it { expect(exist?(file)).to be false } end """ When I run `rspec` Then the specs should all pass
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
aruba-0.9.0.pre | features/api/filesystem/does_exist.feature |