Sha256: e800b5fc8739d4e7d5f73e171a1156e7ac3d4f674ffc830d1b27aa5eaa410cbd
Contents?: true
Size: 1.81 KB
Versions: 5
Compression:
Stored size: 1.81 KB
Contents
require 'spec_helper' describe "directives" do before(:each) do $deplomat_tasks = [] end it "executes arbitrary ruby code in a particular environment" do $env = 'staging' expect(self).to receive(:hello).exactly(1).times execute_in(env: 'staging') { hello() } execute_in(env: 'production') { hello() } end it "creates a partial" do partial("hello_partial") { hello() } expect($partials["hello_partial"][:block]).to be_kind_of(Proc) end it "executes a partial" do expect(self).to receive(:hello).with("hello").exactly(1).times partial("hello_partial") { |args| hello(args[:x]) } execute_partial "hello_partial", x: 'hello' end it "executes tasks consecutively, running before and after callbacks" do $out = "" def task1; $out += "task1"; end def task2; $out += "task2"; end def task3; $out += ",task3"; end before_task(:task1, 1) { $out += "before_task1:" } after_task(:task1, 2) { $out += ":after_task1," } before_task(:task2, 3) { $out += "before_task2:" } after_task(:task2, 4) { $out += ":after_task2" } before_task(:task4, 5) { $out += "before_task4:" } after_task(:task4, 6) { $out += ":after_task4" } add_task :task1, :task2, :task3 execute_tasks! expect($out).to eq("before_task1:task1:after_task1,before_task2:task2:after_task2,task3") end it "loads and runs requisites" do def task1;end def task2;end add_task :task1, :task2 result = load_requisites!(1, requisites_path: "#{File.expand_path(File.dirname(__FILE__))}/deployment_requisites") expect(result[:counter]).to eq(2) expect(result[:log]).to eq(["Loading requisite: 2_req.rb"]) execute_tasks! expect($deployment_requisites_test_file1).to be_nil expect($deployment_requisites_test_file2).to be_truthy end end
Version data entries
5 entries across 5 versions & 1 rubygems