rspec-pretty_fail_formatter 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +5 -0
- data/LICENSE.md +22 -0
- data/README.md +74 -0
- data/Rakefile +2 -0
- data/lib/rspec-pretty_fail_formatter.rb +24 -0
- data/rspec-pretty_fail_formatter.gemspec +18 -0
- metadata +64 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1dcd888ceb3e2ab0f00f0601b682b69994c4c710
|
4
|
+
data.tar.gz: ed04239ec3d58a01fcb526ae03b452300b8b59a5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c810b6232950bafeee4815c76825576be0ab3fcafa922cf5ed9b72b2dc7431ba89190264f0ad8a40c6af6bdcf46c12b68a9f2e2f3bfb64a588d12bc0b4fdf90e
|
7
|
+
data.tar.gz: ec92274804c65ecae750cd3f00fbc205ddb7763e2c4c35e5bdf6cad0c7e203fb4efab0fa904236efd0bd33d0651dfa0c6789215c588eec20b77d65372c450063
|
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# Copyright (c) 2015 Philipp Tessenow
|
2
|
+
|
3
|
+
```
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
```
|
data/README.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Pretty Fail Formatter
|
2
|
+
|
3
|
+
An rspec formatter which is concise on success and pretty on failures. It behaves like the standard formatter, printing only nice green dots.
|
4
|
+
Except when a spec failes, then it prints the failing spec verbosely, so that you instantly see what's wrong.
|
5
|
+
|
6
|
+
$ bundle exec rspec spec/models/admin_spec.rb -f PrettyFailFormatter
|
7
|
+
....F
|
8
|
+
|
9
|
+
1) Admin#does something stupid
|
10
|
+
Failure/Error: expect(subject.stupid).to be true
|
11
|
+
|
12
|
+
expected: true
|
13
|
+
got: false
|
14
|
+
|
15
|
+
(compared using ==)
|
16
|
+
|
17
|
+
Diff:
|
18
|
+
@@ -1,2 +1,2 @@
|
19
|
+
-true
|
20
|
+
+false
|
21
|
+
|
22
|
+
# ./spec/models/admin_spec.rb:44:in `block (3 levels) in <top (required)>'
|
23
|
+
...........
|
24
|
+
|
25
|
+
Finished in 1.24 seconds (files took 3.64 seconds to load)
|
26
|
+
16 examples, 1 failure
|
27
|
+
|
28
|
+
Failed examples:
|
29
|
+
|
30
|
+
rspec ./spec/models/admin_spec.rb:37 # Admin#does something stupid
|
31
|
+
|
32
|
+
## Installation
|
33
|
+
|
34
|
+
Put it in your `Gemfile`
|
35
|
+
|
36
|
+
gem 'rspec-pretty_fail_formatter'
|
37
|
+
|
38
|
+
Run `bundle install`
|
39
|
+
|
40
|
+
If you don't user Bundler you can install it using the `gem` command:
|
41
|
+
|
42
|
+
$ gem install rspec-pretty_fail_formatter
|
43
|
+
|
44
|
+
# Usage
|
45
|
+
|
46
|
+
Add the following to your `spec/spec_helper.rb` file:
|
47
|
+
|
48
|
+
require 'rspec-pretty_fail_formatter'
|
49
|
+
|
50
|
+
Add (or change) the following in your `.rspec` file:
|
51
|
+
|
52
|
+
--format PrettyFailFormatter
|
53
|
+
|
54
|
+
Alternatively, you can add the following to the `spec/spec_helper.rb` file:
|
55
|
+
|
56
|
+
RSpec.configure {|c| c.add_formatter PrettyFailFormatter }
|
57
|
+
|
58
|
+
or run rspec with the propper command line argument:
|
59
|
+
|
60
|
+
$ rspec --f PrettyFailFormatter
|
61
|
+
|
62
|
+
|
63
|
+
## Contributing
|
64
|
+
|
65
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
66
|
+
* Check out the github issues to make sure someone already hasn't requested it and/or contributed it
|
67
|
+
* Fork the project
|
68
|
+
* Start a feature/bugfix branch
|
69
|
+
* Commit and push until you are happy with your contribution
|
70
|
+
|
71
|
+
## Copyright
|
72
|
+
|
73
|
+
Copyright (c) 2015 Philipp Tessenow. This project is MIT licensed, see LICENSE.md for details.
|
74
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'rspec/core/formatters/progress_formatter'
|
3
|
+
|
4
|
+
require 'pry'
|
5
|
+
|
6
|
+
class PrettyFailFormatter < RSpec::Core::Formatters::ProgressFormatter
|
7
|
+
RSpec::Core::Formatters.register self, :example_passed, :example_pending, :example_failed, :start_dump
|
8
|
+
|
9
|
+
def initialize(*args)
|
10
|
+
@failure_index = 0
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
def example_failed(notification)
|
15
|
+
@failure_index += 1
|
16
|
+
output.print RSpec::Core::Formatters::ConsoleCodes.wrap('F', :failure)
|
17
|
+
output.puts
|
18
|
+
output.puts notification.fully_formatted(@failure_index)
|
19
|
+
end
|
20
|
+
|
21
|
+
def dump_failures(notification)
|
22
|
+
return # already printed them inline
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "rspec-pretty_fail_formatter"
|
3
|
+
s.version = '0.0.1'
|
4
|
+
s.platform = Gem::Platform::RUBY
|
5
|
+
s.authors = ["Philipp Tessenow"]
|
6
|
+
s.email = ["philipp@tessenow.org"]
|
7
|
+
s.homepage = "https://github.com/tessi/rspec-pretty_fail_formatter"
|
8
|
+
s.summary = %q{An rspec formatter which is concise on success and pretty on failures}
|
9
|
+
s.description = %q{An rspec formatter which is concise on success and pretty on failures}
|
10
|
+
s.licenses = ["MIT"]
|
11
|
+
|
12
|
+
s.files = `git ls-files`.split("\n")
|
13
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
15
|
+
s.require_paths = ["lib"]
|
16
|
+
|
17
|
+
s.add_dependency 'rspec', [">= 3.0.0"]
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rspec-pretty_fail_formatter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Philipp Tessenow
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.0.0
|
27
|
+
description: An rspec formatter which is concise on success and pretty on failures
|
28
|
+
email:
|
29
|
+
- philipp@tessenow.org
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- Gemfile
|
35
|
+
- LICENSE.md
|
36
|
+
- README.md
|
37
|
+
- Rakefile
|
38
|
+
- lib/rspec-pretty_fail_formatter.rb
|
39
|
+
- rspec-pretty_fail_formatter.gemspec
|
40
|
+
homepage: https://github.com/tessi/rspec-pretty_fail_formatter
|
41
|
+
licenses:
|
42
|
+
- MIT
|
43
|
+
metadata: {}
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options: []
|
46
|
+
require_paths:
|
47
|
+
- lib
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - '>='
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
requirements: []
|
59
|
+
rubyforge_project:
|
60
|
+
rubygems_version: 2.0.14
|
61
|
+
signing_key:
|
62
|
+
specification_version: 4
|
63
|
+
summary: An rspec formatter which is concise on success and pretty on failures
|
64
|
+
test_files: []
|