Sha256: ff214a698c07c5c6e914adcd04c2cac1882a6ddb6e4fd9fe0e3e1fe0908125ce

Contents?: true

Size: 858 Bytes

Versions: 31

Compression:

Stored size: 858 Bytes

Contents

require 'spec_helper'

describe Jekyll::Cloudfront::Invalidator do
  describe "#invalidate cloudfront items" do
    it "should retrieve all objects from the S3 bucket and call invalidation on them" do
      s3_object_keys = ["key1", "key2"]
      s3_objects = s3_object_keys.map { |key| S3Object.new(key) }
      @s3_bucket_name = "my-s3-bucket"
      AWS::S3::Bucket.expects(:find).with(@s3_bucket_name).returns(S3Bucket.new(s3_objects))
      CloudfrontS3Invalidator::CloudfrontClient.any_instance.
        expects(:invalidate).with(s3_object_keys)

      Jekyll::Cloudfront::Invalidator.invalidate("", "", @s3_bucket_name, "")
    end
  end
end

class S3Bucket
  def initialize(s3_objects)
    @s3_objects = s3_objects
  end

  def objects
    @s3_objects
  end
end

class S3Object
  def initialize(key)
    @key = key
  end

  def key
    @key
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
jekyll-s3-yearofmoo-0.0.14 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.13 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.12 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.11 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.10 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.9 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.8 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.7 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.6 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.5 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.4 spec/lib/invalidator_spec.rb