features/support/image_thumbnails_steps.rb in middleman-simple-thumbnailer-1.1.0 vs features/support/image_thumbnails_steps.rb in middleman-simple-thumbnailer-1.2.0

- old
+ new

@@ -1,34 +1,70 @@ require 'base64' +def calculate_resized_image_b64(resize_str) + base_image = MiniMagick::Image.open(File.expand_path("../../fixtures/basic-app/source/images/original.jpg", __dir__)) + base_image.resize(resize_str) + Base64.strict_encode64(base_image.to_blob) +end +image10x10 = "<img src=\"data:image/jpeg;base64,"+calculate_resized_image_b64("10x10>")+"\" class=\"image-resized-to10x10\" />" + +image5x5 = "<img src=\"data:image/jpeg;base64,"+calculate_resized_image_b64("5x5")+"\" class=\"image-resized-to5x5\" />" + +srcset20x20 = "<source srcset=\"data:image/jpeg;base64,"+calculate_resized_image_b64("20x20")+"\" media=\"(min-width: 900px)\">" + +srcset15x15 = "<source srcset=\"data:image/jpeg;base64,"+calculate_resized_image_b64("15x15")+"\" media=\"(min-width: 900px)\">" + Given(/^there is no cache directory yet$/) do if directory? MiddlemanSimpleThumbnailer::Extension.config.cache_dir remove MiddlemanSimpleThumbnailer::Extension.config.cache_dir end end Then(/^I should see base64ed thumbnails of the images$/) do - image10x10 = "<img src=\"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlu\nbwIQAABtbnRyUkdCIFhZWiAHzgACAAkABgAxAABhY3NwTVNGVAAAAABJRUMg\nc1JHQgAAAAAAAAAAAAAAAQAA9tYAAQAAAADTLUhQICAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFjcHJ0AAABUAAA\nADNkZXNjAAABhAAAAGx3dHB0AAAB8AAAABRia3B0AAACBAAAABRyWFlaAAAC\nGAAAABRnWFlaAAACLAAAABRiWFlaAAACQAAAABRkbW5kAAACVAAAAHBkbWRk\nAAACxAAAAIh2dWVkAAADTAAAAIZ2aWV3AAAD1AAAACRsdW1pAAAD+AAAABRt\n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zbLtsw1zLXNNc21zjbOts83z7jQOdC60TzRvtI/0sHT\nRNPG1EnUy9VO1dHWVdbY11zX4Nhk2OjZbNnx2nba+9uA3AXcit0Q3ZbeHN6i\n3ynfr+A24L3hROHM4lPi2+Nj4+vkc+T85YTmDeaW5x/nqegy6LzpRunQ6lvq\n5etw6/vshu0R7ZzuKO6070DvzPBY8OXxcvH/8ozzGfOn9DT0wvVQ9d72bfb7\n94r4Gfio+Tj5x/pX+uf7d/wH/Jj9Kf26/kv+3P9t////2wBDAAgFBgcGBQgH\nBgcJCAgJDBMMDAsLDBgREg4THBgdHRsYGxofIywlHyEqIRobJjQnKi4vMTIx\nHiU2OjYwOiwwMTD/2wBDAQgJCQwKDBcMDBcwIBsgMDAwMDAwMDAwMDAwMDAw\nMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDD/wAARCAACAAUD\nAREAAhEBAxEB/8QAFAABAAAAAAAAAAAAAAAAAAAAB//EABkQAQACAwAAAAAA\nAAAAAAAAAAECAwARMf/EABUBAQEAAAAAAAAAAAAAAAAAAAID/8QAFREBAQAA\nAAAAAAAAAAAAAAAAAAH/2gAMAwEAAhEDEQA/ACFkxoqIqGnmWov/2Q==\n\" class=\"image-resized-to5x5\" />" step %Q{I should see '#{image10x10}'} step %Q{I should see '#{image5x5}'} end + +Then(/^I should see base64ed thumbnails and srcset of the images$/) do + step %Q{I should see '#{image10x10}'} + step %Q{I should see '#{image5x5}'} + step %Q{I should see '#{srcset20x20}'} + step %Q{I should see '#{srcset15x15}'} +end + + Then(/^the cache directory should exist (?:at "([^"]+)" )?with the following files$/) do |cache_dir, files| cache_dir ||= MiddlemanSimpleThumbnailer::Extension.config.cache_dir check_directory_presence([cache_dir], true) cd cache_dir files.raw.map{|file_row| file_row[0]}.each { |f| expect(f).to be_existing_file } end +Then(/^I should see base64ed data of the cached thumbnails with image path$/) do + # data that won't ever be generated by resizing an actual image + cached_10x10_data = "foo" + cached_5x5_data = "bar" + cached_15x15_data = "hello" + cached_20x20_data = "world" + cachedimage10x10 = "<img src=\"data:image/jpeg;base64,#{Base64.strict_encode64(cached_10x10_data)}\" class=\"image-resized-to10x10\" />" + cachedimage5x5 = "<img src=\"data:image/jpeg;base64,#{Base64.strict_encode64(cached_5x5_data)}\" class=\"image-resized-to5x5\" />" + cachedsrcset20x20 = "<source srcset=\"data:image/jpeg;base64,#{Base64.strict_encode64(cached_20x20_data)}\" media=\"(min-width: 900px)\">" + cachedsrcset15x15 = "<source srcset=\"data:image/jpeg;base64,#{Base64.strict_encode64(cached_15x15_data)}\" media=\"(min-width: 900px)\">" + step %Q{I should see '#{cachedimage10x10}'} + step %Q{I should see '#{cachedimage5x5}'} + step %Q{I should see '#{cachedsrcset20x20}'} + step %Q{I should see '#{cachedsrcset15x15}'} +end + Then(/^I should see base64ed data of the cached thumbnails$/) do # data that won't ever be generated by resizing an actual image cached_10x10_data = "foo" cached_5x5_data = "bar" - image10x10 = "<img src=\"data:image/jpeg;base64,#{Base64.encode64(cached_10x10_data)}\" class=\"image-resized-to10x10\" />" - image5x5 = "<img src=\"data:image/jpeg;base64,#{Base64.encode64(cached_5x5_data)}\" class=\"image-resized-to5x5\" />" - step %Q{I should see '#{image10x10}'} - step %Q{I should see '#{image5x5}'} + cachedimage10x10 = "<img src=\"data:image/jpeg;base64,#{Base64.strict_encode64(cached_10x10_data)}\" class=\"image-resized-to10x10\" />" + cachedimage5x5 = "<img src=\"data:image/jpeg;base64,#{Base64.strict_encode64(cached_5x5_data)}\" class=\"image-resized-to5x5\" />" + step %Q{I should see '#{cachedimage10x10}'} + step %Q{I should see '#{cachedimage5x5}'} end Then(/^the following images should exist:$/) do |table| table.hashes.each do |row| in_current_dir do