11. ec2_spec.rb
# -*- coding: utf-8 -*-
require_relative "spec_helper"
describe "EC2" do
ec2 = AWS::EC2.new
describe "Instances" do
subject(:instances) do
ec2.instances.select { |i| i.status != :terminated }
end
it { should have(1).instances }
end
end
12. test-server_spec.rb
# -*- coding: utf-8 -*-
require_relative "./spec_helper"
describe "EC2" do
before :all do
@ec2 = AWS::EC2.new
@instance = @ec2.instances.find { |i| i.tags[:Name] == "test-server" && i.status !
= :terminated }
end
describe "instance" do
it { @instance.should_not be_nil }
end
describe "Instance Type" do
it { @instance.instance_type.should == "m3.large" }
end
end