rspec_yah_formatter 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5991db17503bca41a3362fac0f61251f74a54b28
4
- data.tar.gz: 86a6427828f37541f17b084b4367b834394c6fe8
3
+ metadata.gz: fadff7e240dc6674f7d356501e47e53aee9d91d2
4
+ data.tar.gz: 2a76d915da277a119c1262d6c56df1b767aa20e9
5
5
  SHA512:
6
- metadata.gz: 302fafb381ee493bdecb3d31880cf46b7c00ceea78ff117cf48c8f2008c582e64c15cc925a5ade94a27023786de6dc0f9aefe82c82b36b1593813e5c15341329
7
- data.tar.gz: e2f8343a74dcaa27b4a57d9d8faa258f85dd396d4ce9e5d0c08b62948a248ebff46e2f832e754855f666f672ccc7e5bc711e96b440b58c7274494e0a492a971e
6
+ metadata.gz: 876f4f04bd416fc7eb1b93fdeef5b53fdce0094862d8db5bfbcdf3f31d4bbaf8dcac6c6fcb1402b3dadf84150902ae94b7f6f65492edb066bda906f06c7e47c3
7
+ data.tar.gz: d258630cb6f0f65c8e9b62c9b7f2ea02798e65571073a167a457365d4bd9d4d87324471766b1ce05e884eae28d40a402d96c72c10e76d0c5803de998a68ab9a1
data/README.md CHANGED
@@ -1,22 +1,48 @@
1
1
  # PLEASE NOTE - This is a fork from [rspec_reports_formatter](https://github.com/kingsleyh/rspec_reports_formatter)
2
2
 
3
- # Publish pretty [rspec](http://rspec.info/) reports
3
+ # Publish pretty [rspec](http://rspec.info/) reports with images
4
4
 
5
- This is a ruby Rspec custom formatter which generates pretty html reports showing the results of rspec tests. This gem was build to use Rspec 3.x.x
5
+ This is a RSpec formatter which generates pretty html reports showing the results of rspec tests, where you can also easily attach images and screenshots.
6
+
7
+ ## Why another formatter?
8
+
9
+ On CI servers, xUnit xml test reports are quite "standard", but the attachments cannot be linked to a concrete test. I mean, just [look at this](https://wiki.jenkins-ci.org/download/attachments/42467572/junit-attachments.png).
10
+
11
+ The RSpec HTML formatter is a prettier alternative, but it still doesn't allow to attach images.
12
+
13
+ With `rspec_yah_formatter` you can attach images, which is very useful for `capybara`, `selenium` and so on.
14
+
15
+ Plus, the interface kingsleyh created with [rspec_reports_formatter](https://github.com/kingsleyh/rspec_reports_formatter) looks much nicer.
16
+
17
+ ## Features
18
+
19
+ This report is inspired in [rspec_reports_formatter](https://github.com/kingsleyh/rspec_reports_formatter), with some differences:
20
+
21
+ - All examples are shown in the same page. This makes it simpler, and also
22
+ avoids [this](https://github.com/kingsleyh/rspec_reports_formatter/issues/3)
23
+ - As mentioned, you can add images
24
+ - To avoid that the page is filled with stacktraces and images, errors are by default hidden, and you can show them by clicking on them.
25
+ - This report only makes sense in html, so you must specify a file in `--out`when running rspec
26
+ - Removed the "magic" Gherkin processing of the comments on the specs
27
+
28
+ Here is also the [Changelog](../../wiki/Changelog) and a [TODO list](../../wiki/TODO-list)
6
29
 
7
30
  ## Install
8
31
 
32
+ This gem was build to use Rspec 3.x.x
33
+
9
34
  ```
10
- gem install rspec_yah_formatter -v 0.0.1
35
+ gem install rspec_yah_formatter -v 0.0.4
11
36
  ```
12
37
 
13
38
  ideally just add it to your bundler Gemfile as follows:
14
39
 
15
40
  ```ruby
16
- gem 'rspec_yah_formatter','~> 0.0.1'
41
+ gem 'rspec_yah_formatter','~> 0.0.4'
17
42
  ```
18
43
 
19
44
  ## Use
45
+
20
46
  When running your rspec tests with rspec 3.0.0 just use the custom formatter:
21
47
 
22
48
  This should work:
@@ -31,13 +57,16 @@ If not you can explicitly add in a require as follows:
31
57
  rspec --require rspec_yah_formatter.rb --format RspecYahFormatter spec
32
58
  ```
33
59
 
60
+ To add images:
34
61
 
35
- ![example report]
36
- This report is inspired in [rspec_reports_formatter](https://github.com/kingsleyh/rspec_reports_formatter), with some differences:
62
+ ```
63
+ RSpec.configure do |config|
64
+ config.after(:each) do |example|
65
+ if example.exception
66
+ # Save screenshot to 'path/to/foo.png'
67
+ example.metadata[:screenshot] = 'path/to/foo.png'
68
+ end
69
+ end
70
+ end
71
+ ```
37
72
 
38
- - All examples are shown in the same page. This makes it simpler, and also
39
- avoids [this](https://github.com/kingsleyh/rspec_reports_formatter/issues/3)
40
- - **You can add images**. To do that, you have to create a png in the same folder where --out is, and name it `<spec-filename>-<line-with-error>.png`. The formatter will pick up the images automatically. It's quite restrictive, but this will be worked out later.
41
- - To avoid that the page is filled with stacktraces and images, errors are by default hidden, and you can show them by clicking on them.
42
- - This report only makes sense in html, so you must specify a file in `--out`when running rspec
43
- - Removed the "magic" Gherkin processing of the comments on the specs
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
data/lib/example.rb CHANGED
@@ -18,7 +18,7 @@ class Example
18
18
  @exception = Oopsy.new(example.exception, @file_path)
19
19
  filename = File.basename(@metadata[:file_path])
20
20
  line_number = @metadata[:line_number]
21
- @screenshot = "#{filename}-#{line_number}.png"
21
+ @screenshot = @metadata[:screenshot] || "#{filename}-#{line_number}.png"
22
22
  @spec = nil
23
23
  end
24
24
 
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: rspec_yah_formatter 0.0.3 ruby lib
5
+ # stub: rspec_yah_formatter 0.0.4 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "rspec_yah_formatter"
9
- s.version = "0.0.3"
9
+ s.version = "0.0.4"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_yah_formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kingsley Hendrickse