Sha256: 627676f8d119bceb3e77ba93f03aae733a670dc2d3c0a3347107bcea3ead2ec8

Contents?: true

Size: 1.74 KB

Versions: 3

Compression:

Stored size: 1.74 KB

Contents

Given(/^a folder "(.*?)" is given as the input$/) do |dir|
  @input = dir
end

Given(/^an image "(.*?)" is given as the input$/) do |file|
  @input = file
  @options = {}
end

Given(/^an output folder "(.*?)" is created$/) do |dir|
  Dir.mkdir dir rescue "Directory exists, continue…"
end

Given(/^everything is logged$/) do
  require 'logger'
  @logger = Logger.new STDOUT 
end

Given(/^"(.*?)" is given as poster type option$/) do |type|
  @options[:type] = type.to_sym
  @options[:stroke] = '#000000' if @options[:type] == :standard
end

# ===================================================================================

When(/^I call the collage method$/) do
  @output = Magick::Screwdrivers::collage @input, {:logger => @logger}
end

When(/^I call the scale method with widths (\d+),(\d+),(\d+)$/) do |arg1, arg2, arg3|
  opts = {
    :logger => @logger,
    :widths => [arg1.to_i,arg2.to_i,arg3.to_i],
    :date_in_watermark => true,
    :watermark => 'rmagick-screwdrivers'
  }
  @output = Magick::Screwdrivers::scale @input, opts
end

When(/^save file to "(.*?)"$/) do |file|
  @output.write File.join(file)
end

When(/^save files with origin "(.*?)"$/) do |orig|
  @output.each { |img|
    img.write("#{orig}-#{img.rows}.#{img.format.downcase}") { self.quality = 90 }
  }
end

When(/^I call the poster method with texts "(.*?)" and "(.*?)"$/) do |text1, text2|
  @options[:logger] = @logger
  @output = Magick::Screwdrivers::poster @input, text1, text2, @options
end


# ===================================================================================

Then(/^the result is created as "(.*?)"$/) do |img|
  expect(@output.inspect).to match(/#{img}/)
end

Then(/^the result is created as an array of size (\d+)$/) do |arg1|
  expect(@output.size).to eql(3)
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rmagick-screwdrivers-0.2.0 features/step_definitions/rmagick-screwdrivers_steps.rb
rmagick-screwdrivers-0.1.2 features/step_definitions/rmagick-screwdrivers_steps.rb
rmagick-screwdrivers-0.1.1 features/step_definitions/rmagick-screwdrivers_steps.rb