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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rspec +1 -1
  4. data/.travis.yml +9 -0
  5. data/Appraisals +31 -0
  6. data/CHANGELOG.md +16 -0
  7. data/Gemfile +1 -0
  8. data/README.md +23 -17
  9. data/Rakefile +9 -1
  10. data/capybara-screenshot.gemspec +7 -1
  11. data/gemfiles/cucumber.1.2.gemfile +9 -0
  12. data/gemfiles/cucumber.1.2.gemfile.lock +99 -0
  13. data/gemfiles/cucumber.1.3.0.gemfile +9 -0
  14. data/gemfiles/cucumber.1.3.0.gemfile.lock +100 -0
  15. data/gemfiles/latest.gemfile +8 -0
  16. data/gemfiles/latest.gemfile.lock +102 -0
  17. data/gemfiles/rspec.2.14.gemfile +9 -0
  18. data/gemfiles/rspec.2.14.gemfile.lock +98 -0
  19. data/gemfiles/rspec.2.99.gemfile +9 -0
  20. data/gemfiles/rspec.2.99.gemfile.lock +98 -0
  21. data/gemfiles/rspec.3.0.gemfile +9 -0
  22. data/gemfiles/rspec.3.0.gemfile.lock +102 -0
  23. data/gemfiles/spinach.0.7.gemfile +9 -0
  24. data/gemfiles/spinach.0.7.gemfile.lock +100 -0
  25. data/gemfiles/spinach.0.8.0.gemfile +9 -0
  26. data/gemfiles/spinach.0.8.0.gemfile.lock +100 -0
  27. data/lib/capybara-screenshot.rb +5 -0
  28. data/lib/capybara-screenshot/capybara.rb +12 -0
  29. data/lib/capybara-screenshot/cucumber.rb +18 -12
  30. data/lib/capybara-screenshot/minitest.rb +15 -16
  31. data/lib/capybara-screenshot/rspec.rb +19 -11
  32. data/lib/capybara-screenshot/rspec/text_reporter.rb +21 -3
  33. data/lib/capybara-screenshot/spinach.rb +22 -6
  34. data/lib/capybara-screenshot/testunit.rb +25 -7
  35. data/lib/capybara-screenshot/version.rb +1 -1
  36. data/spec/cucumber/cucumber_spec.rb +64 -0
  37. data/spec/cucumber/step_definitions/step_definitions.rb +18 -0
  38. data/spec/cucumber/support/env.rb +17 -0
  39. data/spec/feature/minitest_spec.rb +90 -0
  40. data/spec/feature/testunit_spec.rb +71 -0
  41. data/spec/rspec/rspec_spec.rb +101 -0
  42. data/spec/spec_helper.rb +9 -1
  43. data/spec/spinach/spinach_spec.rb +53 -0
  44. data/spec/spinach/support/spinach_failure.rb +41 -0
  45. data/spec/support/common_setup.rb +28 -0
  46. data/spec/support/html_reporter_context.rb +1 -1
  47. data/spec/support/test_app.rb +13 -0
  48. data/spec/{rspec → unit}/base_reporter_spec.rb +2 -2
  49. data/spec/{rspec_spec.rb → unit/capybara-screenshot_rspec_spec.rb} +15 -10
  50. data/spec/{capybara-screenshot_spec.rb → unit/capybara-screenshot_spec.rb} +8 -8
  51. data/spec/unit/capybara_spec.rb +50 -0
  52. data/spec/{rspec → unit/rspec_reporters}/html_embed_reporter_spec.rb +2 -2
  53. data/spec/{rspec → unit/rspec_reporters}/html_link_reporter_spec.rb +2 -2
  54. data/spec/unit/rspec_reporters/text_reporter_spec.rb +96 -0
  55. data/spec/{rspec → unit/rspec_reporters}/textmate_link_reporter_spec.rb +5 -3
  56. data/spec/unit/saver_spec.rb +269 -0
  57. metadata +161 -41
  58. data/spec/capybara-screenshot/capybara_spec.rb +0 -18
  59. data/spec/capybara-screenshot/saver_spec.rb +0 -269
  60. 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