lib/gnawrnip/rspec.rb in gnawrnip-0.0.1 vs lib/gnawrnip/rspec.rb in gnawrnip-0.0.2

- old
+ new

@@ -1,15 +1,19 @@ require 'rspec' require 'tempfile' require 'base64' RSpec.configure do |config| - config.after do + config.before(:each, turnip: true) do + Gnawrnip::Animation.reset! + end + + config.after(:each, turnip: true) do if example.exception - temp = Tempfile.new(['gnawrnip', '.png']) - save_screenshot(temp.path) - example.metadata[:turnip] ||= {} - example.metadata[:turnip][:screenshot] = Base64.encode64(File.read(temp.path)) - temp.close! + example.metadata[:gnawrnip] = {} + + # example.metadata[:gnawrnip][:screenshot] = Gnawrnip::Animation.generate + image = Gnawrnip::Screenshot.take + example.metadata[:gnawrnip][:screenshot] = Base64.encode64(image.read) end end end