capybara-screenshot 0.3.22 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rspec +1 -1
- data/.travis.yml +9 -0
- data/Appraisals +31 -0
- data/CHANGELOG.md +16 -0
- data/Gemfile +1 -0
- data/README.md +23 -17
- data/Rakefile +9 -1
- data/capybara-screenshot.gemspec +7 -1
- data/gemfiles/cucumber.1.2.gemfile +9 -0
- data/gemfiles/cucumber.1.2.gemfile.lock +99 -0
- data/gemfiles/cucumber.1.3.0.gemfile +9 -0
- data/gemfiles/cucumber.1.3.0.gemfile.lock +100 -0
- data/gemfiles/latest.gemfile +8 -0
- data/gemfiles/latest.gemfile.lock +102 -0
- data/gemfiles/rspec.2.14.gemfile +9 -0
- data/gemfiles/rspec.2.14.gemfile.lock +98 -0
- data/gemfiles/rspec.2.99.gemfile +9 -0
- data/gemfiles/rspec.2.99.gemfile.lock +98 -0
- data/gemfiles/rspec.3.0.gemfile +9 -0
- data/gemfiles/rspec.3.0.gemfile.lock +102 -0
- data/gemfiles/spinach.0.7.gemfile +9 -0
- data/gemfiles/spinach.0.7.gemfile.lock +100 -0
- data/gemfiles/spinach.0.8.0.gemfile +9 -0
- data/gemfiles/spinach.0.8.0.gemfile.lock +100 -0
- data/lib/capybara-screenshot.rb +5 -0
- data/lib/capybara-screenshot/capybara.rb +12 -0
- data/lib/capybara-screenshot/cucumber.rb +18 -12
- data/lib/capybara-screenshot/minitest.rb +15 -16
- data/lib/capybara-screenshot/rspec.rb +19 -11
- data/lib/capybara-screenshot/rspec/text_reporter.rb +21 -3
- data/lib/capybara-screenshot/spinach.rb +22 -6
- data/lib/capybara-screenshot/testunit.rb +25 -7
- data/lib/capybara-screenshot/version.rb +1 -1
- data/spec/cucumber/cucumber_spec.rb +64 -0
- data/spec/cucumber/step_definitions/step_definitions.rb +18 -0
- data/spec/cucumber/support/env.rb +17 -0
- data/spec/feature/minitest_spec.rb +90 -0
- data/spec/feature/testunit_spec.rb +71 -0
- data/spec/rspec/rspec_spec.rb +101 -0
- data/spec/spec_helper.rb +9 -1
- data/spec/spinach/spinach_spec.rb +53 -0
- data/spec/spinach/support/spinach_failure.rb +41 -0
- data/spec/support/common_setup.rb +28 -0
- data/spec/support/html_reporter_context.rb +1 -1
- data/spec/support/test_app.rb +13 -0
- data/spec/{rspec → unit}/base_reporter_spec.rb +2 -2
- data/spec/{rspec_spec.rb → unit/capybara-screenshot_rspec_spec.rb} +15 -10
- data/spec/{capybara-screenshot_spec.rb → unit/capybara-screenshot_spec.rb} +8 -8
- data/spec/unit/capybara_spec.rb +50 -0
- data/spec/{rspec → unit/rspec_reporters}/html_embed_reporter_spec.rb +2 -2
- data/spec/{rspec → unit/rspec_reporters}/html_link_reporter_spec.rb +2 -2
- data/spec/unit/rspec_reporters/text_reporter_spec.rb +96 -0
- data/spec/{rspec → unit/rspec_reporters}/textmate_link_reporter_spec.rb +5 -3
- data/spec/unit/saver_spec.rb +269 -0
- metadata +161 -41
- data/spec/capybara-screenshot/capybara_spec.rb +0 -18
- data/spec/capybara-screenshot/saver_spec.rb +0 -269
- data/spec/rspec/text_reporter_spec.rb +0 -76
@@ -1,76 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Capybara::Screenshot::RSpec::TextReporter do
|
4
|
-
before do
|
5
|
-
# Mocking `RSpec::Core::Formatters::ProgressFormatter`, but only implementing the methods that
|
6
|
-
# are actually used in `TextReporter#dump_failure_info_with_screenshot`.
|
7
|
-
@reporter_class = Class.new do
|
8
|
-
attr_reader :output
|
9
|
-
|
10
|
-
def initialize
|
11
|
-
@output = StringIO.new
|
12
|
-
end
|
13
|
-
|
14
|
-
protected
|
15
|
-
|
16
|
-
def long_padding
|
17
|
-
" "
|
18
|
-
end
|
19
|
-
|
20
|
-
def failure_color(str)
|
21
|
-
"colorized(#{str})"
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def dump_failure_info(example)
|
27
|
-
output.puts "original failure info"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
@reporter = @reporter_class.new
|
32
|
-
@reporter.singleton_class.send :include, described_class
|
33
|
-
end
|
34
|
-
|
35
|
-
context 'when there is no screenshot' do
|
36
|
-
let(:example) { double("example", metadata: {}) }
|
37
|
-
|
38
|
-
it 'doesnt change the original output of the reporter' do
|
39
|
-
@reporter.dump_failure_info(example)
|
40
|
-
@reporter.output.string.should == "original failure info\n"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'when a html file was saved' do
|
45
|
-
let(:example) { double("example", metadata: { screenshot: { html: "path/to/html" } }) }
|
46
|
-
|
47
|
-
it 'appends the html file path to the original output' do
|
48
|
-
@reporter.dump_failure_info(example)
|
49
|
-
@reporter.output.string.should == "original failure info\n #{"HTML screenshot: path/to/html".yellow}\n"
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
context 'when a html file and an image were saved' do
|
54
|
-
let(:example) { double("example", metadata: { screenshot: { html: "path/to/html", image: "path/to/image" } }) }
|
55
|
-
|
56
|
-
it 'appends the image path to the original output' do
|
57
|
-
@reporter.dump_failure_info(example)
|
58
|
-
@reporter.output.string.should == "original failure info\n #{"HTML screenshot: path/to/html".yellow}\n #{"Image screenshot: path/to/image".yellow}\n"
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
|
63
|
-
it 'works with older RSpec formatters where `#red` is used instead of `#failure_color`' do
|
64
|
-
old_reporter_class = Class.new(@reporter_class) do
|
65
|
-
undef_method :failure_color
|
66
|
-
def red(str)
|
67
|
-
"red(#{str})"
|
68
|
-
end
|
69
|
-
end
|
70
|
-
old_reporter = old_reporter_class.new
|
71
|
-
old_reporter.singleton_class.send :include, described_class
|
72
|
-
example = double("example", metadata: { screenshot: { html: "path/to/html" } })
|
73
|
-
old_reporter.dump_failure_info(example)
|
74
|
-
old_reporter.output.string.should == "original failure info\n #{"HTML screenshot: path/to/html".yellow}\n"
|
75
|
-
end
|
76
|
-
end
|