Sha256: a7c8603b7f6371b5231a9eade320bb2ddc3232deefcfc8a2e9c8c9713eb660d3

Contents?: true

Size: 1.25 KB

Versions: 3

Compression:

Stored size: 1.25 KB

Contents

Feature: Write to a file atomically

Scenario: Write a file atomically
  When I run the following Ruby code:
    """ruby
    require 'sugar_utils'
    puts SugarUtils::File.atomic_write('dir/test', 'foobar')
    """
  Then the file named "dir/test" should contain exactly:
    """
    foobar
    """

Scenario: Overwrite a file atomically
  Given a file named "dir/test" with "deadbeef"
  When I run the following Ruby code:
    """ruby
    require 'sugar_utils'
    puts SugarUtils::File.atomic_write('dir/test', 'foobar')
    """
  Then the file named "dir/test" should contain exactly:
    """
    foobar
    """

# TODO: Fix the owner/group setting check
Scenario: Overwrite a file and reset its permissions atomically
  Given a file named "dir/test" with "deadbeef"
  When I run the following Ruby code:
    """ruby
    require 'sugar_utils'
    puts SugarUtils::File.atomic_write(
      'dir/test',
      'foobar',
      # owner: 'nobody',
      # group: 'nogroup',
      mode:  0o777
    )
    """
  Then the file named "dir/test" should contain exactly:
    """
    foobar
    """
    And the file named "dir/test" should have permissions "777"
    # And the file named "dir/test" should have owner "nobody"
    # And the file named "dir/test" should have group "nogroup"

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sugar_utils-0.8.0 features/atomic_write_file.feature
sugar_utils-0.7.0 features/atomic_write_file.feature
sugar_utils-0.6.0 features/atomic_write_file.feature