Contents

Examining files

In order to test a running system As an administrator I want to examine files

Background Given that "cuken/file" has been required

Scenario: File exists

@steps

  • Given the file "foo.file" contains nothing
  • Then the file "foo.file" exists

Scenario: File does not exist

@steps

  • Then the file "foo.filepants" does not exist

Scenario: Atime

@steps

  • Given the file "foo.file" contains nothing
  • And we record the a-mtime of "foo.file"
  • And I run `sleep 1`
  • And I run `touch -a foo.file`
  • Then the atime of "foo.file" changes

Scenario: Mtime

@steps

  • Given the file "foo.file" contains nothing
  • And we record the a-mtime of "foo.file"
  • And I run `sleep 1`
  • And I run `touch -m foo.file`
  • Then the mtime of "foo.file" changes

Scenario: File contents

@steps

  • When I write to "monkeytest.file":
    monkeypants
    monkeyshorts
  • Then the file "monkeytest.file" contains "monkeypants"

Scenario: File contents exact match

@steps

  • When I write to "monkeytest.file":
    monkeypants
    monkeyshorts
    
  • Then the file "monkeytest.file" contains exactly:
    monkeypants
    monkeyshorts
    

Scenario: File contents multiple matches

  • When I write to "monkeytest.file":
    monkeypants
    monkeyshorts
    monkeypants
    monkeyshorts
    
  • Then the file "monkeytest.file" contains "monkeyp" exactly "2" times
  • Then the file "monkeytest.file" does not contain "monkey" exactly "2" times

Scenario: File modes

@steps

  • When I run `touch filemode.file`
  • And I run `chmod 644 filemode.file`
  • Then the file "filemode.file" has octal mode "188"
  • And the file "filemode.file" has octal mode "33188"
  • And the file "filemode.file" has decimal mode "644"
  • And the file "filemode.file" has decimal mode "0644"

Scenario: Directory exists

@steps

  • When I run `mkdir -p dirtest`
  • Then the directory "dirtest" exists

Scenario: Directory does not exist

@steps

  • Then the directory "dirtest-m000" does not exist

Scenario: Directory modes

@steps

  • When I run `mkdir -p dirtest`
  • And I run `chmod 755 dirtest`
  • Then the directory "dirtest" has decimal mode "755"
  • And the directory "dirtest" has decimal mode "2755"
  • Then the directory "dirtest" has octal mode "901"
  • And the directory "dirtest" has octal mode "17901"

Source: features/file_examples/files.feature at commit efec2546, Cuken (Apache-2.0 license).