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.35 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.33 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.32 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.31 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.30 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.29 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.28 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.27 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.26 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.25 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.24 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.23 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.22 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.21 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.20 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.19 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.18 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.17 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.16 spec/lib/invalidator_spec.rb
jekyll-s3-yearofmoo-0.0.15 spec/lib/invalidator_spec.rb