rspec-kungfuhamster 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 83e445d6b6f36abbdc071fa90fc752bbe001d090
4
+ data.tar.gz: a6e0f962912f05dfa28af4069871ba5e004f9b7d
5
+ SHA512:
6
+ metadata.gz: f768b438b5f6d2032b2d6006547755c6474a5960b373af949a42789e0ec1ab61cb287634ec506ccfdfd05da3f2b85178afa6e1217cf6ef7959013c4a48d0b80e
7
+ data.tar.gz: 9be05a6034129734b493b0e5cb302abbb3be9f5cad59ed97e06d863c37bb4da826223d925b82fa673dd3a8608a57f2f48df13f18e2678b9b2bdaccf6c4f98404
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Thomas Powell
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 all
13
+ 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 THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ rspec-kungfuhamster
2
+ ======================
3
+
4
+ Animated kung fu hamster formatter
@@ -0,0 +1,79 @@
1
+ require 'rspec'
2
+ require 'rspec/core/formatters/base_text_formatter'
3
+
4
+ rspec_bin = $0.split('/').last
5
+
6
+ class RspecKungFuHamster < RSpec::Core::Formatters::BaseTextFormatter
7
+ RSpec::Core::Formatters.register self,
8
+ # :start,
9
+ # :example_start
10
+ # :message,
11
+ :example_passed
12
+ # :example_pending,
13
+ # :example_failed,
14
+ # :dump_failures
15
+
16
+ def initialize(output)
17
+ @index = 0
18
+ super(output)
19
+ end
20
+
21
+ def example_passed(notification)
22
+ output.puts "\e[2J\e[;H" << hamster_and_next.join("\n")
23
+ end
24
+ def example_failed(notification)
25
+ output.puts "\e[2J\e[;H" << hamster_and_next.join("\n")
26
+ sleep 0.1
27
+ end
28
+
29
+ def hamster_and_next
30
+ KUNG_FU_HAMSTER[@index % KUNG_FU_HAMSTER.length].tap { @index += 1 }
31
+ end
32
+
33
+ KUNG_FU_HAMSTER = [
34
+ [
35
+ " ()__() ",
36
+ " / o o\\ | ",
37
+ " |' =Y=';-| ",
38
+ " { \\ / } ",
39
+ " mmm mmm "
40
+ ],[
41
+ " ()__() ",
42
+ " / o o\\ ; ",
43
+ " |' =Y=';-/ ",
44
+ " { \\ / } ",
45
+ " mmm mmm "
46
+ ],[
47
+ " ()__() ",
48
+ " / o o\\ ",
49
+ " |' =Y=';----",
50
+ " { \\ / } ",
51
+ " mmm mmm "
52
+ ],[
53
+ " ()__() ",
54
+ " / o o\\ ",
55
+ " |' =Y=';-\\ ",
56
+ " { \\ / } \\ ",
57
+ " mmm mmm "
58
+ ],[
59
+ " ()__() ",
60
+ " / o o\\ ",
61
+ " |' =Y=';----",
62
+ " { \\ / } ",
63
+ " mmm mmm "
64
+ ],[
65
+ " ()__() ",
66
+ " / o o\\ \\ ",
67
+ " |' =Y=';-\\ ",
68
+ " { \\ / } ",
69
+ " mmm mmm "
70
+ ]]
71
+
72
+ DEAD_HAMSTER = [
73
+ " ()__() ",
74
+ " / X X\\ | ",
75
+ " |' =Y=';-| ",
76
+ " { \\ / } ",
77
+ " mmm mmm "
78
+ ]
79
+ end
@@ -0,0 +1,7 @@
1
+ require_relative '../lib/rspec_kung_fu_hamster.rb'
2
+ describe RspecKungFuHamster do
3
+ 100.times do |i|
4
+ it { expect(i).to eq i }
5
+ end
6
+ it { expect(RspecKungFuHamster::KUNG_FU_HAMSTER.length).to eq 6 }
7
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rspec-kungfuhamster
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Thomas Powell
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-31 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'
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'
27
+ description: Animated kung fu hamster formatter
28
+ email:
29
+ - twilliampowell@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files:
33
+ - README.md
34
+ - LICENSE
35
+ files:
36
+ - LICENSE
37
+ - README.md
38
+ - lib/rspec_kung_fu_hamster.rb
39
+ - spec/kungfuhamster_spec.rb
40
+ homepage: https://github.com/stringsn88keys/rspec-kungfuhamster
41
+ licenses:
42
+ - MIT
43
+ metadata: {}
44
+ post_install_message:
45
+ rdoc_options:
46
+ - "--charset"
47
+ - UTF-8
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ requirements: []
61
+ rubyforge_project:
62
+ rubygems_version: 2.2.2
63
+ signing_key:
64
+ specification_version: 4
65
+ summary: Rspec kung fu hamster formatter
66
+ test_files:
67
+ - spec/kungfuhamster_spec.rb
68
+ has_rdoc: