Sha256: 80b8c8d4a2a0cab3cc54f79cdbf50dceb39c63435b90b2d59a8bfa1de5b0a0cb
Contents?: true
Size: 832 Bytes
Versions: 3
Compression:
Stored size: 832 Bytes
Contents
module UnitExampleGroup def self.included(base) base.metadata[:type] = :unit base.before do Object.any_instance.stub(:system) { |*args, &block| UnitExampleGroup.prevent_system_calls(*args, &block) } Object.any_instance.stub(:`) { |*args, &block| UnitExampleGroup.prevent_system_calls(*args, &block) } require 'vagrant/util/subprocess' Vagrant::Util::Subprocess.stub(:execute) { |*args, &block| UnitExampleGroup.prevent_system_calls(*args, &block) } end end def self.prevent_system_calls(*args, &block) args.pop if args.last.is_a?(Hash) raise <<-MSG Somehow your code under test is trying to execute a command on your system, please stub it out or move your spec code to an acceptance spec. Command: "#{args.join(' ')}" MSG end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
vagrant-lxc-0.0.3 | spec/support/unit_example_group.rb |
vagrant-lxc-0.0.2 | spec/support/unit_example_group.rb |
vagrant-lxc-0.0.1 | spec/support/unit_example_group.rb |