Sha256: d176faa34c268f41a8e639e3d30fa82f01e06ef7f2017c110e1d53340833633a
Contents?: true
Size: 1.95 KB
Versions: 3
Compression:
Stored size: 1.95 KB
Contents
require 'assert' require 'cap-util/bundler_cmd' class CapUtil::BundlerCmd class UnitTests < Assert::Context desc "CapUtil::BundlerCmd" setup do @fake_cap = CapUtil::FakeCap.new @fake_cap.current_path = "/a/current/path" @fake_cap.release_path = "/dat/release/path" @util = CapUtil::BundlerCmd.new(@fake_cap, 'ls -la') end subject{ @util } should have_imeths :run should "build a bundler cmd to run" do assert_includes '&& bundle exec ls -la', subject.cmd end should "use cap's current path by default" do assert_includes "cd #{@fake_cap.current_path} &&", subject.cmd end should "use a custom cap path if given" do util = CapUtil::BundlerCmd.new(@fake_cap, '', :root => :release_path) assert_includes "cd #{@fake_cap.release_path} &&", util.cmd end should "use a custom env var string if given" do util = CapUtil::BundlerCmd.new(@fake_cap, 'ls -la', :env => "FOO=bar") assert_includes "&& FOO=bar bundle exec ls", util.cmd end should "run its cmd" do exp_cmd = "cd /a/current/path && bundle exec ls -la" subject.run assert_equal exp_cmd, @fake_cap.cmds_run.last end end class TestHelpersTests < UnitTests include TestHelpers desc "TestHelpers" setup do @context = Class.new{ include TestHelpers }.new end subject{ @context } should have_imeths :assert_bundler_cmd should "prove a util is a bundler cmd that was built correctly" do assert_bundler_cmd(@util, @fake_cap, 'ls -la') assert_bundler_cmd(@util, @fake_cap, 'ls -la', :root => :current_path) assert_bundler_cmd(@util, @fake_cap, 'ls -la', :env => '') util = CapUtil::BundlerCmd.new(@fake_cap, 'ls -la', { :root => :release_path, :env => "FOO=bar" }) assert_bundler_cmd(util, @fake_cap, 'ls -la', { :root => :release_path, :env => "FOO=bar" }) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cap-util-1.5.2 | test/unit/bundler_cmd_tests.rb |
cap-util-1.5.1 | test/unit/bundler_cmd_tests.rb |
cap-util-1.5.0 | test/unit/bundler_cmd_tests.rb |