Skip to content

Commit

Permalink
Merge (rebased) pull request #142 from kbruner:master
Browse files Browse the repository at this point in the history
Closes #142
  • Loading branch information
fnichol committed Mar 23, 2015
2 parents 111da5d + 8f19765 commit 556c72c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
31 changes: 31 additions & 0 deletions spec/kitchen/driver/vagrant_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1104,6 +1104,37 @@
RUBY
end
end

context "for managed provider" do

before { config[:provider] = "managed" }

it "adds a line a server" do
config[:customize] = {
:server => "my_server"
}
cmd

expect(vagrantfile).to match(regexify(<<-RUBY.gsub(/^ {8}/, "").chomp))
c.vm.provider :managed do |p|
p.server = "my_server"
end
RUBY
end

it "ignores all other key types than server" do
config[:customize] = {
:other => "stuff",
:is => "ignored"
}
cmd

expect(vagrantfile).to match(regexify(<<-RUBY.gsub(/^ {8}/, "").chomp))
c.vm.provider :managed do |p|
end
RUBY
end
end
end

def debug_lines
Expand Down
4 changes: 4 additions & 0 deletions templates/Vagrantfile.erb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ Vagrant.configure("2") do |c|
<% else %>
p.customize "<%= key %>", "<%= value %>"
<% end %>
<% when "managed" %>
<% if key == :server %>
p.server = "<%= value %>"
<% end %>
<% when "parallels" %>
p.customize ["set", :id, "--<%= key.to_s.gsub('_', '-') %>", "<%= value %>"]
<% when "rackspace" %>
Expand Down

0 comments on commit 556c72c

Please sign in to comment.