diff --git a/spec/Vagrantfile b/spec/Vagrantfile index 6a72bb2..67d553a 100644 --- a/spec/Vagrantfile +++ b/spec/Vagrantfile @@ -23,4 +23,11 @@ Vagrant.configure("2") do |config| cache_dir = local_apt_cache(config.vm.box) config.vm.synced_folder cache_dir, "/var/cache/apt/archives", id: "vagrant-apt-cache" + + config.vm.provision :shell, + inline: 'mkdir -p /vagrant/tmp && echo -n "Provisioned" > /vagrant/tmp/provisioning' + + config.vm.network :forwarded_port, guest: 80, host: 8080 + config.vm.provision :shell, + inline: 'sudo apt-get install apache2 -y' end diff --git a/spec/acceptance/sanity_check_spec.rb b/spec/acceptance/sanity_check_spec.rb index ba5c966..8a46e21 100644 --- a/spec/acceptance/sanity_check_spec.rb +++ b/spec/acceptance/sanity_check_spec.rb @@ -61,14 +61,20 @@ describe 'Sanity check' do end it 'mounts shared folders with the right permissions' do - vagrant_ssh 'mkdir -p /vagrant/tmp && echo "Shared" > /vagrant/tmp/shared' - shared_file_contents = File.read('/vagrant/spec/tmp/shared').chomp + vagrant_ssh 'mkdir -p /vagrant/tmp && echo -n "Shared" > /vagrant/tmp/shared' + shared_file_contents = File.read('/vagrant/spec/tmp/shared') expect(shared_file_contents).to eq 'Shared' end - it 'provisions the container based on Vagrantfile configs' + it 'provisions the container based on Vagrantfile configs' do + provisioned_file_contents = File.read('/vagrant/spec/tmp/provisioning') + expect(provisioned_file_contents).to eq 'Provisioned' + end - it 'forwards configured ports' + it 'forwards configured ports' do + output = `curl -s localhost:8080`.strip.chomp + expect(output).to include 'It works!' + end end context '`vagrant halt` on a running container' do