rspec-emoji-formatter 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f7cdb1278200509152a9db8dc2c47ca5992d4467
4
+ data.tar.gz: c943aa6e302ee78cf56590fc684088630b1784ad
5
+ SHA512:
6
+ metadata.gz: e1d7355e7ce4904da245cbd1ec6ef5b52f6a153fcc135308ab945dc8626c82018826bf1100c305296362ed3136486d0fdfc3e99059fe51befce8ee13be11cc43
7
+ data.tar.gz: 1b41048b72eb48e454ab4010cc75d9702cc615b7d0437a05fb7411206b313e7d300b80b29fbf6b939f6cc47fb2531236d89108ca3cdddef8eca728086f2527f1
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ pkg/
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --require rspec_emoji_formatter
3
+ --format EmojiFormatter
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rspec_emoji_formatter.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,35 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rspec-emoji-formatter (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.2.5)
10
+ rake (10.5.0)
11
+ rspec (3.5.0)
12
+ rspec-core (~> 3.5.0)
13
+ rspec-expectations (~> 3.5.0)
14
+ rspec-mocks (~> 3.5.0)
15
+ rspec-core (3.5.4)
16
+ rspec-support (~> 3.5.0)
17
+ rspec-expectations (3.5.0)
18
+ diff-lcs (>= 1.2.0, < 2.0)
19
+ rspec-support (~> 3.5.0)
20
+ rspec-mocks (3.5.0)
21
+ diff-lcs (>= 1.2.0, < 2.0)
22
+ rspec-support (~> 3.5.0)
23
+ rspec-support (3.5.0)
24
+
25
+ PLATFORMS
26
+ ruby
27
+
28
+ DEPENDENCIES
29
+ bundler (~> 1.13)
30
+ rake (~> 10.0)
31
+ rspec (~> 3.4)
32
+ rspec-emoji-formatter!
33
+
34
+ BUNDLED WITH
35
+ 1.13.3
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Alex Taylor
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,22 @@
1
+ # RspecEmojiFormatter
2
+
3
+ Pretty self-explanatory. Spice up your boring test suite with some 😀
4
+
5
+ ![rspec-emoji-formatter demo](demo.gif)
6
+
7
+ Did your test pass? 😀 Did your test fail? 😡 Is your test pending? 🔷
8
+
9
+ ## Usage
10
+ Install the gem:
11
+
12
+ `gem install rspec-emoji-formatter`
13
+
14
+ Then choose it as your RSpec formatter:
15
+
16
+ `rspec --format EmojiFormatter`
17
+
18
+ Or add this line to your `.rspec` file:
19
+
20
+ `--format EmojiFormatter`
21
+
22
+ Enjoy!
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rspec_emoji_formatter"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/demo.gif ADDED
Binary file
@@ -0,0 +1,67 @@
1
+ require "rspec/core/formatters/console_codes"
2
+
3
+ class EmojiFormatter
4
+
5
+ PROGRESS_ICONS = {
6
+ :example_passed => "\u{1f600}",
7
+ :example_failed => "\u{1f621}",
8
+ :example_pending => "\u{1f537}"
9
+ }
10
+
11
+ RSpec::Core::Formatters.register self, :start, :example_passed, :example_failed,
12
+ :example_pending, :dump_failures, :dump_summary
13
+
14
+ def initialize(output)
15
+ @output = output
16
+ end
17
+
18
+ def start(_)
19
+ @output << "\n"
20
+ end
21
+
22
+ def example_passed(_)
23
+ example_result(:example_passed)
24
+ end
25
+
26
+ def example_failed(_)
27
+ example_result(:example_failed)
28
+ end
29
+
30
+ def example_pending(_)
31
+ example_result(:example_pending)
32
+ end
33
+
34
+ def dump_failures(notifications)
35
+ @output << "\n\n"
36
+
37
+ notifications.failure_notifications.each_with_index do |notification, i|
38
+ data = { i: i + 1, desc: notification.description }
39
+ @output << "%4<i>s) %<desc>s\n" % data
40
+ @output << " `bundle exec rspec #{notification.example.location_rerun_argument}`\n\n"
41
+
42
+ notification.colorized_message_lines.each do |line|
43
+ @output << " #{line}\n"
44
+ end
45
+
46
+ notification.colorized_formatted_backtrace.each do |line|
47
+ @output << " #{line}\n"
48
+ end
49
+
50
+ @output << "\n\n"
51
+ end
52
+ end
53
+
54
+ def dump_summary(summary)
55
+ final_stats = "#{summary.examples.count} examples:\
56
+ #{summary.failed_examples.count} #{PROGRESS_ICONS[:example_failed]} \
57
+ #{summary.pending_examples.count} #{PROGRESS_ICONS[:example_pending]} "
58
+ @output << final_stats
59
+ puts "" # without this we get a % at the end of the output...
60
+ end
61
+
62
+ private
63
+ def example_result(type)
64
+ string = PROGRESS_ICONS[type]
65
+ @output << "#{string} "
66
+ end
67
+ end
@@ -0,0 +1,3 @@
1
+ module RspecEmojiFormatter
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,2 @@
1
+ require "rspec_emoji_formatter/version"
2
+ require "rspec_emoji_formatter/formatter"
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rspec_emoji_formatter/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rspec-emoji-formatter"
8
+ spec.version = RspecEmojiFormatter::VERSION
9
+ spec.authors = ["Alex Taylor"]
10
+ spec.email = ["alexmctaylorpants@gmail.com"]
11
+
12
+ spec.summary = %q{Add some 😀 to your tests!}
13
+ spec.description = %q{A formatter for RSpec that tracks the suite's progress with emojis. Because I wanted to.}
14
+ spec.homepage = "https://github.com/alextaylor000/rspec-emoji-formatter"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.13"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "~> 3.4"
27
+ end
metadata ADDED
@@ -0,0 +1,101 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rspec-emoji-formatter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Alex Taylor
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-11-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.13'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.13'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.4'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.4'
55
+ description: A formatter for RSpec that tracks the suite's progress with emojis. Because
56
+ I wanted to.
57
+ email:
58
+ - alexmctaylorpants@gmail.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - ".rspec"
65
+ - Gemfile
66
+ - Gemfile.lock
67
+ - LICENSE.txt
68
+ - README.md
69
+ - Rakefile
70
+ - bin/console
71
+ - bin/setup
72
+ - demo.gif
73
+ - lib/rspec_emoji_formatter.rb
74
+ - lib/rspec_emoji_formatter/formatter.rb
75
+ - lib/rspec_emoji_formatter/version.rb
76
+ - rspec_emoji_formatter.gemspec
77
+ homepage: https://github.com/alextaylor000/rspec-emoji-formatter
78
+ licenses:
79
+ - MIT
80
+ metadata: {}
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubyforge_project:
97
+ rubygems_version: 2.4.5.1
98
+ signing_key:
99
+ specification_version: 4
100
+ summary: "Add some \U0001F600 to your tests!"
101
+ test_files: []