Sha256: 97c609e22bc3b18cbf7354b4c5a5d7850a8b3cf3ad3433c6c7e0da6abcbb8c9a
Contents?: true
Size: 975 Bytes
Versions: 4
Compression:
Stored size: 975 Bytes
Contents
require 'assert' require 'cap-util/unset_var' module CapUtil class UnsetVarTests < Assert::Context desc "the unset var helper" setup do @var_name = 'test' @unset = UnsetVar.new(@var_name) end subject { @unset } should "be a proc" do assert_kind_of ::Proc, subject end should "raise `Halted` when called" do assert_raises(CapUtil::Halted) { subject.call } end should "raise with a default msg based on the variable name" do exp_msg = ":#{@var_name} var not set." begin subject.call rescue CapUtil::Halted => err assert_match exp_msg, err.message end end should "accept a custom msg to raise with" do exp_msg = ":#{@var_name} var not set (a custom err msg)." unset = CapUtil::UnsetVar.new(@var_name, exp_msg) begin unset.call rescue CapUtil::Halted => err assert_match exp_msg, err.message end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
cap-util-1.1.0 | test/unset_var_tests.rb |
cap-util-1.0.1 | test/unset_var_tests.rb |
cap-util-1.0.0 | test/unset_var_tests.rb |
cap-util-1.0.0.rc1 | test/unset_var_tests.rb |