Sha256: acbeca1f21f28b12bd5ec090148cd75b88ec047772140e227a3d2553c71ae888

Contents?: true

Size: 1.5 KB

Versions: 3

Compression:

Stored size: 1.5 KB

Contents

Then(/^the file named "(.*?)" should have a file format of "(.*?)"$/) do |filename, format|
  case format
  when 'lz4'
    assert_exact_output(
      %w[04224d18].pack('H8'),
      File.open(filename, 'rb') { |f| f.read(4) } || String.new
    )
  when 'xz'
    assert_exact_output(
      %w[fd377a585a00].pack('H12'),
      File.open(filename, 'rb') { |f| f.read(6) } || String.new
    )
  when 'qcow2v3', 'qcow3'
    steps %{
      When I successfully run `qemu-img info #{filename}`
      Then the output from "qemu-img info #{filename}" should contain "file format: qcow2"
      And the output from "qemu-img info #{filename}" should contain "compat: 1.1"
    }
  else
    assert_no_partial_output(
      %w[04224d18].pack('H8'),
      File.open(filename, 'rb') { |f| f.read(4) } || String.new
    )
    assert_no_partial_output(
      %w[fd377a585a00].pack('H12'),
      File.open(filename, 'rb') { |f| f.read(6) } || String.new
    )
    steps(%{
      When I successfully run `qemu-img info #{filename}`
      Then the output from "qemu-img info #{filename}" should contain "file format: #{format}"
      And the output from "qemu-img info #{filename}" should not contain "compat: 1.1"
    })
  end
end

Given(/^a correctly initialised cache at "(.*?)"$/) do |basedir|
  steps %{
    Given a directory named "#{basedir}/cache"
    And a directory named "#{basedir}/temp"
  }
end

Given(/^an empty directory named "([^"]*)"$/) do |dir_name|
  create_dir(dir_name)
  FileUtils.rm_rf(File.join(dir_name, '.'), :secure => true)
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
uricp-0.0.37 features/step_definitions/uricp_steps.rb
uricp-0.0.36 features/step_definitions/uricp_steps.rb
uricp-0.0.35 features/step_definitions/uricp_steps.rb