mock/stub -> double

This commit is contained in:
Fabio Rehm 2013-07-13 13:41:39 -03:00
parent c14ca57d17
commit 09208a0d28
5 changed files with 14 additions and 14 deletions

View file

@ -3,9 +3,9 @@ require 'unit_helper'
require 'vagrant-lxc/action/clear_forwarded_ports'
describe Vagrant::LXC::Action::ClearForwardedPorts do
let(:app) { mock(:app, call: true) }
let(:env) { {machine: machine, ui: stub(info: true)} }
let(:machine) { mock(:machine, data_dir: data_dir) }
let(:app) { double(:app, call: true) }
let(:env) { {machine: machine, ui: double(info: true)} }
let(:machine) { double(:machine, data_dir: data_dir) }
let!(:data_dir) { Pathname.new(Dir.mktmpdir) }
let(:pids_dir) { data_dir.join('pids') }
let(:pid) { 'a-pid' }

View file

@ -3,8 +3,8 @@ require 'unit_helper'
require 'vagrant-lxc/action/compress_rootfs'
describe Vagrant::LXC::Action::CompressRootFS do
let(:app) { mock(:app, call: true) }
let(:env) { {machine: machine, ui: stub(info: true)} }
let(:app) { double(:app, call: true) }
let(:env) { {machine: machine, ui: double(info: true)} }
let(:machine) { instance_double('Vagrant::Machine', provider: provider) }
let(:provider) { instance_double('Vagrant::LXC::Provider', driver: driver) }
let(:driver) { instance_double('Vagrant::LXC::Driver', compress_rootfs: compressed_rootfs_path) }

View file

@ -3,9 +3,9 @@ require 'unit_helper'
require 'vagrant-lxc/action/forward_ports'
describe Vagrant::LXC::Action::ForwardPorts do
let(:app) { mock(:app, call: true) }
let(:env) { {machine: machine, ui: stub(info: true)} }
let(:machine) { mock(:machine) }
let(:app) { double(:app, call: true) }
let(:env) { {machine: machine, ui: double(info: true)} }
let(:machine) { double(:machine) }
let!(:data_dir) { Pathname.new(Dir.mktmpdir) }
let(:networks) { [[:other_config, {}], [:forwarded_port, {guest: guest_port, host: host_port}]] }
let(:host_port) { 8080 }

View file

@ -5,10 +5,10 @@ require 'vagrant-lxc/errors'
require 'vagrant-lxc/action/handle_box_metadata'
describe Vagrant::LXC::Action::HandleBoxMetadata do
let(:app) { mock(:app, call: true) }
let(:env) { {machine: machine, ui: stub(info: true)} }
let(:machine) { mock(:machine, box: box) }
let(:box) { mock(:box, name: 'box-name', metadata: metadata, directory: box_directory) }
let(:app) { double(:app, call: true) }
let(:env) { {machine: machine, ui: double(info: true)} }
let(:machine) { double(:machine, box: box) }
let(:box) { double(:box, name: 'box-name', metadata: metadata, directory: box_directory) }
let(:box_directory) { Pathname.new('/path/to/box') }
let(:version) { '2' }
let(:metadata) { {'template-opts' => {'--foo' => 'bar'}, 'version' => version} }

View file

@ -3,8 +3,8 @@ require 'unit_helper'
require 'vagrant-lxc/action/setup_package_files'
describe Vagrant::LXC::Action::SetupPackageFiles do
let(:app) { mock(:app, call: true) }
let(:env) { {machine: machine, tmp_path: tmp_path, ui: stub(info: true), 'package.rootfs' => rootfs_path} }
let(:app) { double(:app, call: true) }
let(:env) { {machine: machine, tmp_path: tmp_path, ui: double(info: true), 'package.rootfs' => rootfs_path} }
let(:machine) { instance_double('Vagrant::Machine', box: box) }
let!(:tmp_path) { Pathname.new(Dir.mktmpdir) }
let(:box) { instance_double('Vagrant::Box', directory: tmp_path.join('box')) }