Sha256: b5c37431ad659258e1f46a3c9556ec42ad89e86ff378e7906ac366074856a81c

Contents?: true

Size: 1.82 KB

Versions: 18

Compression:

Stored size: 1.82 KB

Contents

Given /the snapshots are cleared/ do
  snapshot_map(VBoxManage.snapshots(@output)) do |snapshot|
    VBoxManage.execute("snapshot", @name, "delete", snapshot[:name])
  end
end

Given /the following snapshot tree is created:$/ do |tree|
  tree.hashes.each do |hash|
    restore_parent = lambda do
      VBoxManage.execute("snapshot", @name, "restore", hash["key"])
    end

    begin
      restore_parent.call
    rescue Exception
      VBoxManage.execute("snapshot", @name, "take", hash["key"])
    end

    hash["children"].split(",").each do |child|
      VBoxManage.execute("snapshot", @name, "take", child)
      restore_parent.call
    end
  end
end

Given /the snapshot "(.+?)" is created/ do |name|
  VBoxManage.execute("snapshot", @name, "take", name)
end

When /I find the snapshot named "(.+?)"/ do |name|
  @snapshot = @model.find_snapshot(name)
  @snapshot.should be
end

When /I take a snapshot "(.+?)"/ do |name|
  @model.take_snapshot(name)
end

When /I destroy the snapshot/ do
  @snapshot.destroy
end

Then /the snapshot "(.+?)" should exist/ do |name|
  result = false
  snapshot_map(VBoxManage.snapshots(@output)) do |snapshot|
    result = true if snapshot[:name] == name
  end

  result.should be
end

Then /the snapshot "(.+?)" should not exist/ do |name|
  result = false
  snapshot_map(VBoxManage.snapshots(@output)) do |snapshot|
    result = true if snapshot[:name] == name
  end

  result.should_not be
end

Then /the snapshots should match/ do
  @root = @model.root_snapshot

  match_tester = lambda do |current, expected|
    current.uuid.should == expected[:uuid]
    current.children.length.should == expected[:children].length

    current.children.each_with_index do |current_child, i|
      match_tester.call(current_child, expected[:children][i])
    end
  end

  match_tester.call(@root, VBoxManage.snapshots(@output))
end

Version data entries

18 entries across 18 versions & 3 rubygems

Version Path
virtualbox-0.9.2 features/step_definitions/snapshot_steps.rb
virtualbox-0.9.1 features/step_definitions/snapshot_steps.rb
virtualbox-0.9.0 features/step_definitions/snapshot_steps.rb
virtualbox-0.8.6 features/step_definitions/snapshot_steps.rb
virtualbox-0.8.5 features/step_definitions/snapshot_steps.rb
virtualbox-0.8.4 features/step_definitions/snapshot_steps.rb
velir_virtualbox-0.8.4 features/step_definitions/snapshot_steps.rb
virtualbox-0.8.3 features/step_definitions/snapshot_steps.rb
virtualbox-0.8.2 features/step_definitions/snapshot_steps.rb
virtualbox-0.8.1 features/step_definitions/snapshot_steps.rb
virtualbox-0.8.0 features/step_definitions/snapshot_steps.rb
virtualbox-0.7.9 features/step_definitions/snapshot_steps.rb
virtualbox-0.7.8 features/step_definitions/snapshot_steps.rb
virtualbox-0.7.7 features/step_definitions/snapshot_steps.rb
virtualbox-0.7.6 features/step_definitions/snapshot_steps.rb
bbrowning-virtualbox-0.7.6.dev features/step_definitions/snapshot_steps.rb
virtualbox-0.7.5 features/step_definitions/snapshot_steps.rb
virtualbox-0.7.4 features/step_definitions/snapshot_steps.rb