Created
January 9, 2012 21:46
-
-
Save mwhagedorn/1585124 to your computer and use it in GitHub Desktop.
Relevant fragment of server_spec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
context "server#addresses" do | |
context "and there is a private address key" do | |
it "returns the ip address" do | |
@server.should_receive(:addresses).any_number_of_times.and_return({"private"=>[{"version"=>4, "addr"=>"10.0.2.76"}]}) | |
@server.private_ip_address.should == "10.0.2.76" | |
end | |
end | |
context "and there is not a private address key" do | |
it "server#private_ip_address returns nil" do | |
#Stricly speaking this scenario cannot occur | |
@server.should_receive(:addresses).any_number_of_times.and_return({"public"=>[{"version"=>4, "addr"=>"10.0.2.76"}]}) | |
@server.private_ip_address.should == nil | |
end | |
end | |
context "and there is a public address key" do | |
it "returns the public ip address key" do | |
@server.should_receive(:addresses).any_number_of_times.and_return({"private"=>[{"version"=>4, "addr"=>"10.0.2.76"}], | |
"public"=>[{"version"=>4, "addr"=>"15.10.2.76"}]}) | |
@server.public_ip_address.should == "15.10.2.76" | |
end | |
end | |
context "and there is not a public address key" do | |
it "server#public_ip_address returns nil" do | |
@server.should_receive(:addresses).any_number_of_times.and_return({"private"=>[{"version"=>4, "addr"=>"10.0.2.76"}]}) | |
@server.public_ip_address.should == nil | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment