Sha256: b92ed63ffc1b163c9348e3dc47b612fa93a3dab87de557ede539e3cbfd702df9

Contents?: true

Size: 1.41 KB

Versions: 2

Compression:

Stored size: 1.41 KB

Contents

# Helpers

def create_app(*opts)
  app = App.new(*opts)
  FileUtils.rm_f(app.dmg_filename)
  write_file(app.plist_path, app.plist_content)
  app
end


def attach_dmg
  assert_dmg_exists
  create_dir(volumes_dir)
  cmd = "hdiutil attach '#{@app.dmg_filename}' -nobrowse -mountroot '#{volumes_dir}'"
  run_simple(cmd, true)
end

def detach_dmg
  in_current_dir do
    Dir.glob("#{volumes_dir}/*") do |dir|
      system("hdiutil detach '#{dir}' -force >/dev/null")
    end
  end
end

def assert_dmg_exists
  check_file_presence([@app.dmg_filename], true)
end

def volumes_dir
  'Volumes' # We don't want to attach to '/Volumes' in our tests.
end


# Hooks

After do
  detach_dmg
end


# Step definitions

Given(/^an App$/) do
  @app = create_app
end

Given(/^an App in a directory$/) do
  @app = create_app(:prefix => 'Stuff')
end

When(/^I wrap the App$/) do
  cmd = "wrapp '#{@app.app_path}'"
  run_simple(unescape(cmd))
end

When(/^I wrap the App including the parent directory$/) do
  cmd = "wrapp --include-parent-dir '#{@app.app_path}'"
  run_simple(unescape(cmd))
end

Then(/^the App should be wrapped$/) do
  attach_dmg
  attached_app_path = File.join(volumes_dir, @app.app_name)
  check_directory_presence([attached_app_path], true)
end

Then(/^the App should be wrapped including the parent directory$/) do
  attach_dmg
  attached_app_path = File.join(volumes_dir, @app.prefix)
  check_directory_presence([attached_app_path], true)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wrapp-0.2.1 features/step_definitions/wrapp_steps.rb
wrapp-0.2.0 features/step_definitions/wrapp_steps.rb