capybara-screenshot 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/capybara-screenshot.gemspec +0 -1
- data/lib/capybara-screenshot/helpers.rb +28 -0
- data/lib/capybara-screenshot/rspec/text_reporter.rb +3 -2
- data/lib/capybara-screenshot/saver.rb +2 -9
- data/lib/capybara-screenshot/version.rb +1 -1
- data/spec/unit/rspec_reporters/text_reporter_spec.rb +4 -3
- metadata +3 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69ef8524d6a1e9eac83ce7e0118dde66868db2f4
|
4
|
+
data.tar.gz: 1b25e9089581366bef163c5c43f138c1a64dc4b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd6b12eda2b5ef9478fc80f23be5180133c6d227056a59e7e8934e79f8eb3530a9030b06ce4bb1883c28d300ed4a689060e60450b8dd379cdd02bd08ef33c068
|
7
|
+
data.tar.gz: 495fb5805c72ff2ee19f72cbd90688eea958acada85fb31548f706fa67e7e9f54e925d7a483407571cc9184a2d0fdd6c231419259101fe04cff4563442ac2258
|
data/CHANGELOG.md
CHANGED
data/capybara-screenshot.gemspec
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
class CapybaraScreenshot
|
2
|
+
module Helpers
|
3
|
+
extend self
|
4
|
+
|
5
|
+
COLORS =
|
6
|
+
{
|
7
|
+
"black" => 0,
|
8
|
+
"red" => 1,
|
9
|
+
"green" => 2,
|
10
|
+
"yellow" => 3,
|
11
|
+
"blue" => 4,
|
12
|
+
"purple" => 5,
|
13
|
+
"magenta" => 5,
|
14
|
+
"cyan" => 6,
|
15
|
+
"white" => 7
|
16
|
+
}
|
17
|
+
|
18
|
+
COLORS.each_pair do |color, value|
|
19
|
+
define_method color do |text|
|
20
|
+
"\033[0;#{30+value}m#{text}\033[0m"
|
21
|
+
end
|
22
|
+
|
23
|
+
define_method "bright_#{color}" do |text|
|
24
|
+
"\033[1;#{30+value}m#{text}\033[0m"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'capybara-screenshot/rspec/base_reporter'
|
2
|
+
require 'capybara-screenshot/helpers'
|
2
3
|
|
3
4
|
module Capybara
|
4
5
|
module Screenshot
|
@@ -25,8 +26,8 @@ module Capybara
|
|
25
26
|
private
|
26
27
|
def output_screenshot_info(example)
|
27
28
|
return unless (screenshot = example.metadata[:screenshot])
|
28
|
-
output.puts(long_padding + "HTML screenshot: #{screenshot[:html]}"
|
29
|
-
output.puts(long_padding + "Image screenshot: #{screenshot[:image]}"
|
29
|
+
output.puts(long_padding + CapybaraScreenshot::Helpers.yellow("HTML screenshot: #{screenshot[:html]}")) if screenshot[:html]
|
30
|
+
output.puts(long_padding + CapybaraScreenshot::Helpers.yellow("Image screenshot: #{screenshot[:image]}")) if screenshot[:image]
|
30
31
|
end
|
31
32
|
|
32
33
|
def long_padding
|
@@ -1,11 +1,4 @@
|
|
1
|
-
|
2
|
-
begin
|
3
|
-
require 'Win32/Console/ANSI'
|
4
|
-
rescue LoadError => e
|
5
|
-
fail "win32console gem is required to output colorized messages, please add this to your Gemfile or install"
|
6
|
-
end
|
7
|
-
end
|
8
|
-
require 'colored'
|
1
|
+
require 'capybara-screenshot/helpers'
|
9
2
|
|
10
3
|
module Capybara
|
11
4
|
module Screenshot
|
@@ -89,7 +82,7 @@ module Capybara
|
|
89
82
|
|
90
83
|
private
|
91
84
|
def output(message)
|
92
|
-
puts " #{
|
85
|
+
puts " #{CapybaraScreenshot::Helpers.yellow(message)}"
|
93
86
|
end
|
94
87
|
end
|
95
88
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'capybara-screenshot/helpers'
|
2
3
|
|
3
4
|
describe Capybara::Screenshot::RSpec::TextReporter do
|
4
5
|
before do
|
@@ -67,7 +68,7 @@ describe Capybara::Screenshot::RSpec::TextReporter do
|
|
67
68
|
|
68
69
|
it 'appends the html file path to the original output' do
|
69
70
|
@reporter.send(example_failed_method, example)
|
70
|
-
expect(@reporter.output.string).to eql("original failure info\n #{"HTML screenshot: path/to/html"
|
71
|
+
expect(@reporter.output.string).to eql("original failure info\n #{CapybaraScreenshot::Helpers.yellow("HTML screenshot: path/to/html")}\n")
|
71
72
|
end
|
72
73
|
end
|
73
74
|
|
@@ -76,7 +77,7 @@ describe Capybara::Screenshot::RSpec::TextReporter do
|
|
76
77
|
|
77
78
|
it 'appends the image path to the original output' do
|
78
79
|
@reporter.send(example_failed_method, example)
|
79
|
-
expect(@reporter.output.string).to eql("original failure info\n #{"HTML screenshot: path/to/html"
|
80
|
+
expect(@reporter.output.string).to eql("original failure info\n #{CapybaraScreenshot::Helpers.yellow("HTML screenshot: path/to/html")}\n #{CapybaraScreenshot::Helpers.yellow("Image screenshot: path/to/image")}\n")
|
80
81
|
end
|
81
82
|
end
|
82
83
|
|
@@ -92,6 +93,6 @@ describe Capybara::Screenshot::RSpec::TextReporter do
|
|
92
93
|
old_reporter.singleton_class.send :include, described_class
|
93
94
|
example = example_failed_method_argument_double(screenshot: { html: "path/to/html" })
|
94
95
|
old_reporter.send(example_failed_method, example)
|
95
|
-
expect(old_reporter.output.string).to eql("original failure info\n #{"HTML screenshot: path/to/html"
|
96
|
+
expect(old_reporter.output.string).to eql("original failure info\n #{CapybaraScreenshot::Helpers.yellow("HTML screenshot: path/to/html")}\n")
|
96
97
|
end
|
97
98
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara-screenshot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew O'Riordan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -44,20 +44,6 @@ dependencies:
|
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0'
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: colored
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
51
|
-
- - ">="
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
54
|
-
type: :runtime
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '0'
|
61
47
|
- !ruby/object:Gem::Dependency
|
62
48
|
name: rspec
|
63
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -199,6 +185,7 @@ files:
|
|
199
185
|
- lib/capybara-screenshot.rb
|
200
186
|
- lib/capybara-screenshot/capybara.rb
|
201
187
|
- lib/capybara-screenshot/cucumber.rb
|
188
|
+
- lib/capybara-screenshot/helpers.rb
|
202
189
|
- lib/capybara-screenshot/minitest.rb
|
203
190
|
- lib/capybara-screenshot/pruner.rb
|
204
191
|
- lib/capybara-screenshot/rspec.rb
|