lib/calabash-cucumber/failure_helpers.rb in calabash-cucumber-0.19.0 vs lib/calabash-cucumber/failure_helpers.rb in calabash-cucumber-0.19.1

- old
+ new

@@ -49,11 +49,16 @@ # @option options {String} :label (uses filename) the label to use in the Cucumber reporters # @return {String} path to the generated screenshot def screenshot_embed(options={:prefix => nil, :name => nil, :label => nil}) path = screenshot(options) filename = options[:label] || File.basename(path) - embed(path, 'image/png', filename) + if self.respond_to?(:embed) + embed(path, 'image/png', filename) + else + RunLoop.log_info2("Embed is not available in this context. Will not embed.") + end + true end # Generates a screenshot of the app UI by calling screenshot_embed and raises an error. # Increments a global counter of screenshots and adds the count to the filename (to ensure uniqueness). # @@ -80,9 +85,8 @@ # @option options {String} :label (uses filename) the label to use in the Cucumber reporters # @raise [RuntimeError] with `msg` def fail(msg='Error. Check log for details.', options={:prefix => nil, :name => nil, :label => nil}) screenshot_and_raise(msg, options) end - end end -end \ No newline at end of file +end