spec/unit/lib/infrataster/server_spec.rb in infrataster-0.2.1 vs spec/unit/lib/infrataster/server_spec.rb in infrataster-0.2.2
- old
+ new
@@ -9,9 +9,26 @@
expect(servers.size).to eq(1)
expect(servers[0].name).to eq('name')
expect(servers[0].address).to eq('127.0.0.1')
expect(servers[0].options).to eq({})
end
+ it "adds a Server instance to defined_servers with block" do
+ described_class.define(:app) do |server|
+ server.address = '127.0.0.1'
+ server.vagrant = true
+ server.from = :proxy
+ end
+ described_class.define(:proxy) do |server|
+ server.address = '127.0.0.1'
+ server.vagrant = true
+ end
+ servers = described_class.defined_servers
+ expect(servers.size).to eq(2)
+ expect(servers[0].name).to eq(:app)
+ expect(servers[0].address).to eq('127.0.0.1')
+ expect(servers[0].options[:vagrant]).to eq(true)
+ expect(servers[0].from).to eq(servers[1])
+ end
end
describe "self.find_by_name" do
it "finds a server by name" do
described_class.define('name', '127.0.0.1', {})