Sha256: 08577eb17e729f5c0ce8b44c92c7601c42c0f8df51b33c55dc02fd3589401021

Contents?: true

Size: 1.74 KB

Versions: 6

Compression:

Stored size: 1.74 KB

Contents

require 'rspec'

When /^my Jekyll site is in "(.*?)"$/ do |blog_dir|
  @blog_dir = blog_dir
end

When /^jekyll-s3 will push my blog to S3$/ do
  do_run
end

Then /^jekyll-s(\d+) will push my blog to S(\d+) and invalidate the Cloudfront distribution$/ do
  |arg1, arg2|
  do_run
end

Then /^the output should equal$/ do |expected_console_output|
  @console_output.should eq(expected_console_output)
end

Then /^the output should contain$/ do |expected_console_output|
  @console_output.should include(expected_console_output)
end

Then /^report that it uploaded (\d+) new and (\d+) changed files into S3$/ do
  |new_count, changed_count|
  @amount_of_new_files.should == new_count.to_i
  @amount_of_changed_files.should == changed_count.to_i
end

Then /^report that it invalidated (\d+) Cloudfront item$/ do |expected|
  @amount_of_invalidated_items.should == expected.to_i
end

Then /^report that it created (\d+) new redirects$/ do |expected|
  @amount_of_new_redirects.should == expected.to_i
end

Then /^report that it deleted (\d+) file from S3$/ do |amount_of_deleted_files|
  @amount_of_deleted_files.should == amount_of_deleted_files.to_i
end

def do_run
  @console_output = capture_stdout {
    in_headless_mode = true
    result = Jekyll::S3::CLI.new.run("#{@blog_dir}/_site", in_headless_mode)
    @amount_of_new_files = result[:new_files_count]
    @amount_of_changed_files = result[:changed_files_count]
    @amount_of_deleted_files = result[:deleted_files_count]
    @amount_of_invalidated_items = result[:invalidated_items_count]
    @amount_of_new_redirects = result[:changed_redirects_count]
  }
end

module Kernel
  require 'stringio'

  def capture_stdout
    out = StringIO.new
    $stdout = out
    yield
    out.string
  ensure
    $stdout = STDOUT
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
jekyll-s3-3.2.0 features/step_definitions/steps.rb
jekyll-s3-3.1.2 features/step_definitions/steps.rb
jekyll-s3-3.1.1 features/step_definitions/steps.rb
jekyll-s3-3.1.0 features/step_definitions/steps.rb
jekyll-s3-3.0.0 features/step_definitions/steps.rb
jekyll-s3-2.8.0 features/step_definitions/steps.rb