"Fossies" - the Fresh Open Source Software Archive

Member "vagrant-2.2.14/test/unit/plugins/provisioners/ansible/cap/guest/arch/ansible_install_test.rb" (20 Nov 2020, 1857 Bytes) of package /linux/misc/vagrant-2.2.14.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Ruby source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 require_relative "../../../../../../base"
    2 require_relative "../shared/pip_ansible_install_examples"
    3 
    4 require Vagrant.source_root.join("plugins/provisioners/ansible/cap/guest/arch/ansible_install")
    5 
    6 describe VagrantPlugins::Ansible::Cap::Guest::Arch::AnsibleInstall do
    7   include_context "unit"
    8 
    9   subject { VagrantPlugins::Ansible::Cap::Guest::Arch::AnsibleInstall }
   10 
   11   let(:iso_env) do
   12     # We have to create a Vagrantfile so there is a root path
   13     env = isolated_environment
   14     env.vagrantfile("")
   15     env.create_vagrant_env
   16   end
   17 
   18   let(:machine) { iso_env.machine(iso_env.machine_names[0], :dummy) }
   19   let(:communicator) { double("comm") }
   20 
   21   before do
   22     allow(machine).to receive(:communicate).and_return(communicator)
   23     allow(communicator).to receive(:execute).and_return(true)
   24   end
   25 
   26   describe "#pip_setup" do
   27     it "install required Arch packages and call Cap::Guest::Pip::get_pip" do
   28       pip_install_cmd = "foo"
   29 
   30       expect(communicator).to receive(:sudo).once.ordered.
   31         with("pacman -Syy --noconfirm")
   32       expect(communicator).to receive(:sudo).once.ordered.
   33         with("pacman -S --noconfirm base-devel curl git python")
   34       expect(VagrantPlugins::Ansible::Cap::Guest::Pip).to receive(:get_pip).once.ordered.
   35         with(machine, pip_install_cmd)
   36 
   37       subject.pip_setup(machine, pip_install_cmd)
   38     end
   39   end
   40 
   41   describe "#ansible_install" do
   42 
   43     it_behaves_like "Ansible setup via pip"
   44 
   45     describe "when install_mode is :default (or unknown)" do
   46       it "installs ansible with 'pacman' package manager" do
   47         expect(communicator).to receive(:sudo).once.ordered.
   48           with("pacman -Syy --noconfirm")
   49         expect(communicator).to receive(:sudo).once.ordered.
   50           with("pacman -S --noconfirm ansible")
   51 
   52         subject.ansible_install(machine, :default, "", "", "")
   53       end
   54     end
   55   end
   56 
   57 end