diff options
Diffstat (limited to 'Library/Homebrew/test/cask/artifact/postflight_block_spec.rb')
| -rw-r--r-- | Library/Homebrew/test/cask/artifact/postflight_block_spec.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Library/Homebrew/test/cask/artifact/postflight_block_spec.rb b/Library/Homebrew/test/cask/artifact/postflight_block_spec.rb new file mode 100644 index 000000000..51b1431f0 --- /dev/null +++ b/Library/Homebrew/test/cask/artifact/postflight_block_spec.rb @@ -0,0 +1,39 @@ +describe Hbc::Artifact::PostflightBlock, :cask do + describe "install_phase" do + it "calls the specified block after installing, passing a Cask mini-dsl" do + called = false + yielded_arg = nil + + cask = Hbc::Cask.new("with-postflight") do + postflight do |c| + called = true + yielded_arg = c + end + end + + described_class.new(cask).install_phase + + expect(called).to be true + expect(yielded_arg).to be_kind_of(Hbc::DSL::Postflight) + end + end + + describe "uninstall_phase" do + it "calls the specified block after uninstalling, passing a Cask mini-dsl" do + called = false + yielded_arg = nil + + cask = Hbc::Cask.new("with-uninstall-postflight") do + uninstall_postflight do |c| + called = true + yielded_arg = c + end + end + + described_class.new(cask).uninstall_phase + + expect(called).to be true + expect(yielded_arg).to be_kind_of(Hbc::DSL::UninstallPostflight) + end + end +end |
