Sha256: 3569d87013ded07048471b477cd607aef7fa8ba9009d3d0088269eca06cd8044

Contents?: true

Size: 1.87 KB

Versions: 3

Compression:

Stored size: 1.87 KB

Contents

require 'spec_helper'

describe Cloudster::ChefClient do
  describe 'initialize' do
    it "should raise argument error if no argument is not provided" do
      expect { Cloudster::CloudFront.new() }.to raise_error(ArgumentError, 'Missing required argument: name')
    end
    it "should not raise argument error if all arguments are provided" do
      expect { Cloudster::CloudFront.new(:name => 'CloudFront') }.to_not raise_error
    end
  end
  describe '#add_to' do
    it "should add elastic ip configuration to ec2 template" do
      bucket = bucket = Cloudster::S3.new(:name => 'S3ResourceName',:access_control => 'PublicRead')
      cloud_front = Cloudster::CloudFront.new(:name => 'CloudFront')
      cloud_front.add_to bucket
      bucket.template.should ==
        {
          "Resources"=>{
            "S3ResourceName"=>{
              "Type"=>"AWS::S3::Bucket",
              "Properties"=>{
                "AccessControl"=>"PublicRead"
              }
            },
            "CloudFront"=>{
              "Type"=>"AWS::CloudFront::Distribution",
              "Properties"=>{
                "DistributionConfig"=> {
                  "S3Origin" => {
                    "DNSName"=>{"Fn::GetAtt"=>["S3ResourceName", "DomainName"]}
                  },
                  "Enabled"=>"true"
                }
              }
            },
          },
          "Outputs" => {
            "S3ResourceName"=>{
              "Value"=>{
                "Fn::Join"=>[",",
                  [
                    {"Fn::Join"=>["|", ["bucket_name", {"Ref"=>"S3ResourceName"}]]},
                    {"Fn::Join"=>["|", ["dns_name", {"Fn::GetAtt"=>["S3ResourceName", "DomainName"]}]]},
                    {"Fn::Join"=>["|", ["website_url", {"Fn::GetAtt"=>["S3ResourceName", "WebsiteURL"]}]]}
                  ]
                ]
              }
            }
          }
        }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cloudster-2.19.2 spec/cloud_front_spec.rb
cloudster-2.19.1 spec/cloud_front_spec.rb
cloudster-2.19.0 spec/cloud_front_spec.rb