lib/gnawrnip/rspec.rb in gnawrnip-0.1.2 vs lib/gnawrnip/rspec.rb in gnawrnip-0.1.3
- old
+ new
@@ -1,16 +1,22 @@
require 'rspec'
-require 'tempfile'
-require 'base64'
RSpec.configure do |config|
+ config.before(:all) do
+ Gnawrnip.ready!
+ end
+
config.before(:each, turnip: true) do
- Gnawrnip::Animation.reset!
+ Gnawrnip.photographer.reset!
+ example.metadata[:gnawrnip] = {}
end
config.after(:each, turnip: true) do
if example.exception
- example.metadata[:gnawrnip] = {}
- example.metadata[:gnawrnip][:screenshot] = Gnawrnip::Animation.frames.compact
+ Gnawrnip.photographer.take_shot
+ screenshots = Gnawrnip.photographer.frames.compact
+ example.metadata[:gnawrnip][:screenshot] = screenshots
+ else
+ Gnawrnip.photographer.discard!
end
end
end