waterpig 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2a2a5a3dc8d067e31bd44da7641251085c79f8a9
4
- data.tar.gz: e9bf6eb922f230797d4281a5aab4151fed8a0d64
3
+ metadata.gz: 8e28d950091067eb55145f9a2a031cc9ccd2aa41
4
+ data.tar.gz: bd5e3b73c0eb55fa931b56a779f33a0729b113f0
5
5
  SHA512:
6
- metadata.gz: 319ea313489f5e5d6df14637712d008e03dfe120a35f50152b5cfb1657541ae2cc3cf332bea0f80cbc7df027facc790a42b6065e806cbf6d99a58b186a73a66d
7
- data.tar.gz: d57ad2069c0d90fdd5274d4969cf02edfab660af5925df482655ea84c6b4f7597c6d36db29dd83ca7e68d122588587e6cdd6d36cf63ae1698919af96e6782930
6
+ metadata.gz: 88cc48ee51e663dbd01ac906b9db6ab19461cb6c39ea7670be1cbf2e990b33730689b9972856ec5fa121bd9c212be8c29ae338b80e72ab6befdc661366fc0817
7
+ data.tar.gz: 29ea658e3a49c190a40e5e8327b87b87be8f462b344716a31c721cfb831165e2b01c27ad629161bcba6e2c9b71132861b398c5ea2f031b821dbe5e1a2371fa56
@@ -19,6 +19,34 @@ module Waterpig
19
19
  return candidate if Capybara.drivers.has_key? candidate
20
20
  end
21
21
  end
22
+
23
+ module ExampleLogger
24
+ def self.included(group)
25
+ group.before :each do |example|
26
+ Rails.logger.fatal do
27
+ "Beginning #{example.full_description} (at #{example.location})"
28
+ end
29
+ end
30
+
31
+ group.after :each do |example|
32
+ Rails.logger.fatal do
33
+ "Finished #{example.full_description} (at #{example.location})"
34
+ end
35
+ end
36
+
37
+ group.before :step do |example|
38
+ Rails.logger.fatal do
39
+ "Beginning step #{example.full_description} (at #{example.location})"
40
+ end
41
+ end
42
+
43
+ group.after :step do |example|
44
+ Rails.logger.fatal do
45
+ "Finished step #{example.full_description} (at #{example.location})"
46
+ end
47
+ end
48
+ end
49
+ end
22
50
  end
23
51
 
24
52
  RSpec.configure do |config|
@@ -60,3 +88,11 @@ RSpec.configure do |config|
60
88
  config.waterpig_browser_size_types && config.waterpig_browser_size_types.include?(value)
61
89
  }
62
90
  end
91
+
92
+ RSpec.configure do |config|
93
+ config.add_setting :waterpig_log_types, :default => [:feature]
94
+
95
+ config.include Waterpig::ExampleLogger, :type => proc{|value|
96
+ config.waterpig_log_types && config.waterpig_log_types.include?(value)
97
+ }
98
+ end
@@ -58,16 +58,29 @@ module Waterpig
58
58
 
59
59
  dir = "tmp/#{dir}"
60
60
 
61
- path = "#{dir}/#{"%03i" % frame_index(dir)}-#{name}.png"
61
+ base_path = "#{dir}/#{"%03i" % frame_index(dir)}-#{name}"
62
+
63
+ img_path = base_path + ".png"
62
64
  begin
63
- page.driver.save_screenshot(path, :full => true)
65
+ page.driver.save_screenshot(img_path, :full => true)
64
66
  rescue Capybara::NotSupportedByDriverError => nsbde
65
67
  BrowserTools.warn("Can't use snapshot", nsbde.inspect)
66
68
  rescue Object => ex
67
- BrowserTools.warn("Error attempted snapshot", ex.inspect)
69
+ BrowserTools.warn("Error when attempting snapshot", ex.inspect)
70
+ end
71
+
72
+ html_path = base_path + ".html"
73
+ begin
74
+ File::open(html_path, "w") do |file|
75
+ file.write page.html
76
+ end
77
+ rescue Capybara::NotSupportedByDriverError => nsbde
78
+ BrowserTools.warn("Can't use page html", nsbde.inspect)
79
+ rescue Object => ex
80
+ BrowserTools.warn("Error in attempted html save", ex.inspect)
68
81
  end
69
82
 
70
- yield path if block_given?
83
+ yield img_path if block_given?
71
84
  end
72
85
 
73
86
  def snapshot(dir)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: waterpig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Judson Lester
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-11 00:00:00.000000000 Z
11
+ date: 2014-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -86,7 +86,7 @@ rdoc_options:
86
86
  - --main
87
87
  - doc/README
88
88
  - --title
89
- - waterpig-0.4.0 Documentation
89
+ - waterpig-0.5.0 Documentation
90
90
  require_paths:
91
91
  - lib/
92
92
  required_ruby_version: !ruby/object:Gem::Requirement