emoji-rspec 0.0.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +4 -0
- data/.ruby-version +1 -1
- data/.travis.yml +1 -1
- data/README.md +320 -4
- data/Rakefile +1 -1
- data/emoji-rspec.gemspec +2 -2
- data/examples/show_some_emoji.rb +23 -0
- data/lib/emoji-rspec.rb +1 -3
- data/lib/{emoji/rspec → emoji_test_love}/formatters.rb +0 -0
- data/lib/emoji_test_love/formatters/adventure_time_formatter.rb +53 -0
- data/lib/emoji_test_love/formatters/aggressive_thumbs_formatter.rb +19 -0
- data/lib/emoji_test_love/formatters/books_formatter.rb +19 -0
- data/lib/emoji_test_love/formatters/celebrate_formatter.rb +19 -0
- data/lib/emoji_test_love/formatters/drinking_game_formatter.rb +19 -0
- data/lib/emoji_test_love/formatters/drinking_game_tea_formatter.rb +19 -0
- data/lib/emoji_test_love/formatters/fruit_formatter.rb +19 -0
- data/lib/emoji_test_love/formatters/kanpai_formatter.rb +21 -0
- data/lib/emoji_test_love/formatters/life_hearts_formatter.rb +19 -0
- data/lib/emoji_test_love/formatters/lucky_formatter.rb +19 -0
- data/lib/emoji_test_love/formatters/omkase_formatter.rb +21 -0
- data/lib/emoji_test_love/formatters/smile_dip_formatter.rb +19 -0
- data/lib/emoji_test_love/formatters/smiley_faces_formatter.rb +19 -0
- data/lib/emoji_test_love/formatters/sunshine_formatter.rb +19 -0
- data/lib/emoji_test_love/formatters/thumbs_formatter.rb +19 -0
- data/lib/emoji_test_love/formatters/turtles_formatter.rb +19 -0
- data/lib/emoji_test_love/formatters/waddles_formatter.rb +19 -0
- data/lib/emoji_test_love/formatters/zen_smiles_formatter.rb +19 -0
- data/lib/emoji_test_love/rspec.rb +17 -0
- data/lib/emoji_test_love/rspec/rspec_formatters.rb +21 -0
- data/lib/emoji_test_love/rspec/rspec_integration.rb +75 -0
- data/lib/emoji_test_love/version.rb +3 -0
- data/spec/formatters/adventure_time_formatter_spec.rb +6 -0
- data/spec/formatters/aggressive_thumbs_formatter_spec.rb +6 -0
- data/spec/formatters/books_formatter_spec.rb +6 -0
- data/spec/formatters/celebrate_formatter_spec.rb +6 -0
- data/spec/formatters/drinking_game_formatter_spec.rb +6 -0
- data/spec/formatters/drinking_game_tea_formatter_spec.rb +6 -0
- data/spec/formatters/fruit_formatter_spec.rb +6 -0
- data/spec/formatters/kanpai_formatter_spec.rb +6 -0
- data/spec/formatters/life_hearts_formatter_spec.rb +6 -0
- data/spec/formatters/lucky_formatter_spec.rb +6 -0
- data/spec/formatters/omkase_formatter_spec.rb +6 -0
- data/spec/formatters/smile_dip_formatter_spec.rb +6 -0
- data/spec/formatters/smiley_faces_formatter_spec.rb +6 -0
- data/spec/formatters/sunshine_formatter_spec.rb +6 -0
- data/spec/formatters/thumbs_formatter_spec.rb +6 -0
- data/spec/formatters/turtles_formatter_spec.rb +6 -0
- data/spec/formatters/waddles_formatter_spec.rb +6 -0
- data/spec/formatters/zen_smiles_formatter_spec.rb +6 -0
- data/spec/generating_formatters_spec.rb +143 -0
- data/spec/spec_helper.rb +0 -0
- data/spec/support/shared_examples_for_formatters.rb +6 -0
- metadata +124 -92
- data/lib/emoji/helper.rb +0 -10
- data/lib/emoji/rspec/formatters/adventure_time_formatter.rb +0 -39
- data/lib/emoji/rspec/formatters/aggressive_thumbs_formatter.rb +0 -27
- data/lib/emoji/rspec/formatters/drinking_game_formatter.rb +0 -27
- data/lib/emoji/rspec/formatters/drinking_game_tea_formatter.rb +0 -27
- data/lib/emoji/rspec/formatters/life_hearts_formatter.rb +0 -27
- data/lib/emoji/rspec/formatters/smiles_formatter.rb +0 -27
- data/lib/emoji/rspec/formatters/thumbs_formatter.rb +0 -27
- data/lib/emoji/rspec/formatters/zen_smiles_formatter.rb +0 -27
- data/lib/emoji/rspec/integration.rb +0 -38
- data/lib/emoji/rspec/version.rb +0 -5
- data/spec/example_formatter_spec.rb +0 -40
@@ -0,0 +1,19 @@
|
|
1
|
+
module EmojiTestLove
|
2
|
+
class AggressiveThumbs
|
3
|
+
def passed_display
|
4
|
+
"\u{1f44c} "
|
5
|
+
end
|
6
|
+
|
7
|
+
def failed_display
|
8
|
+
"\u{1f44a} "
|
9
|
+
end
|
10
|
+
|
11
|
+
def pending_display
|
12
|
+
"\u{270a} "
|
13
|
+
end
|
14
|
+
|
15
|
+
def names
|
16
|
+
['aggressive_thumbs', 'aggressivethumbs']
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module EmojiTestLove
|
2
|
+
class Celebrate
|
3
|
+
def passed_display
|
4
|
+
"\u{1f37b} "
|
5
|
+
end
|
6
|
+
|
7
|
+
def failed_display
|
8
|
+
"\u{2615} "
|
9
|
+
end
|
10
|
+
|
11
|
+
def pending_display
|
12
|
+
"\u{1f355} "
|
13
|
+
end
|
14
|
+
|
15
|
+
def names
|
16
|
+
['celebrate', 'celebration', 'cheers']
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module EmojiTestLove
|
2
|
+
class DrinkingGame
|
3
|
+
def passed_display
|
4
|
+
"\u{2615} "
|
5
|
+
end
|
6
|
+
|
7
|
+
def failed_display
|
8
|
+
"\u{1f378} "
|
9
|
+
end
|
10
|
+
|
11
|
+
def pending_display
|
12
|
+
"\u{1f37a} "
|
13
|
+
end
|
14
|
+
|
15
|
+
def names
|
16
|
+
['drinking', 'drinking_game', 'drinkinggame']
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module EmojiTestLove
|
2
|
+
class DrinkingGameTea
|
3
|
+
def passed_display
|
4
|
+
"\u{1f375} "
|
5
|
+
end
|
6
|
+
|
7
|
+
def failed_display
|
8
|
+
"\u{1f378} "
|
9
|
+
end
|
10
|
+
|
11
|
+
def pending_display
|
12
|
+
"\u{1f37a} "
|
13
|
+
end
|
14
|
+
|
15
|
+
def names
|
16
|
+
['drinking_tea', 'drinking_game_tea', 'drinkingtea', 'drinkinggametea']
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module EmojiTestLove
|
4
|
+
class Kanpai
|
5
|
+
def passed_display
|
6
|
+
"\u{1f376} "
|
7
|
+
end
|
8
|
+
|
9
|
+
def failed_display
|
10
|
+
"\u{1f375} "
|
11
|
+
end
|
12
|
+
|
13
|
+
def pending_display
|
14
|
+
"\u{1f363} "
|
15
|
+
end
|
16
|
+
|
17
|
+
def names
|
18
|
+
['kanpai', '乾杯']
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module EmojiTestLove
|
2
|
+
class LifeHearts
|
3
|
+
def passed_display
|
4
|
+
"\u{1f49a} "
|
5
|
+
end
|
6
|
+
|
7
|
+
def failed_display
|
8
|
+
"\u{1f494} "
|
9
|
+
end
|
10
|
+
|
11
|
+
def pending_display
|
12
|
+
"\u{1f49b} "
|
13
|
+
end
|
14
|
+
|
15
|
+
def names
|
16
|
+
['hearts', 'life', 'life_hearts', 'lifehearts']
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module EmojiTestLove
|
4
|
+
class Omkase
|
5
|
+
def passed_display
|
6
|
+
"\u{1f361} "
|
7
|
+
end
|
8
|
+
|
9
|
+
def failed_display
|
10
|
+
"\u{1f358} "
|
11
|
+
end
|
12
|
+
|
13
|
+
def pending_display
|
14
|
+
"\u{1f365} "
|
15
|
+
end
|
16
|
+
|
17
|
+
def names
|
18
|
+
['omkase', 'お任せ']
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module EmojiTestLove
|
2
|
+
class SmileDip
|
3
|
+
def passed_display
|
4
|
+
"\u{1f36d} "
|
5
|
+
end
|
6
|
+
|
7
|
+
def failed_display
|
8
|
+
"\u{1f47b} "
|
9
|
+
end
|
10
|
+
|
11
|
+
def pending_display
|
12
|
+
"\u{1f42c} "
|
13
|
+
end
|
14
|
+
|
15
|
+
def names
|
16
|
+
['smile_dip', 'smiledip', 'fundip', 'fun_dip', 'aoshima']
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module EmojiTestLove
|
2
|
+
class Turtles
|
3
|
+
def passed_display
|
4
|
+
"\u{1f422} "
|
5
|
+
end
|
6
|
+
|
7
|
+
def failed_display
|
8
|
+
"\u{1f41e} "
|
9
|
+
end
|
10
|
+
|
11
|
+
def pending_display
|
12
|
+
"\u{1f40c} "
|
13
|
+
end
|
14
|
+
|
15
|
+
def names
|
16
|
+
['turtles', 'all_the_way_down', 'turtles_all_the_way_down']
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module EmojiTestLove
|
2
|
+
class ZenSmiles
|
3
|
+
def passed_display
|
4
|
+
"\u{1f610} "
|
5
|
+
end
|
6
|
+
|
7
|
+
def failed_display
|
8
|
+
"\u{1f61e} "
|
9
|
+
end
|
10
|
+
|
11
|
+
def pending_display
|
12
|
+
"\u{1f614} "
|
13
|
+
end
|
14
|
+
|
15
|
+
def names
|
16
|
+
['zen', 'zen_smiles', 'zensmiles']
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rspec/core/configuration'
|
2
|
+
require_relative 'rspec/rspec_integration'
|
3
|
+
require_relative 'rspec/rspec_formatters'
|
4
|
+
|
5
|
+
class RSpec::Core::Configuration
|
6
|
+
|
7
|
+
alias_method :built_in_formatter_without_emoji, :built_in_formatter
|
8
|
+
|
9
|
+
def built_in_formatter(key)
|
10
|
+
key = key.to_s.downcase
|
11
|
+
formatter = ::EmojiTestLove::RSpecIntegration
|
12
|
+
.known_formatters
|
13
|
+
.detect{ |klass| klass.names.map(&:downcase).include? key }
|
14
|
+
formatter || built_in_formatter_without_emoji(key)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'emoji_test_love/formatters'
|
2
|
+
require 'emoji_test_love/rspec/rspec_integration'
|
3
|
+
|
4
|
+
EmojiTestLove::RSpecFormatter(EmojiTestLove::AdventureTime.new, "AdventureTime")
|
5
|
+
EmojiTestLove::RSpecFormatter(EmojiTestLove::AggressiveThumbs.new, "AggressiveThumbs")
|
6
|
+
EmojiTestLove::RSpecFormatter(EmojiTestLove::Books.new, "Books")
|
7
|
+
EmojiTestLove::RSpecFormatter(EmojiTestLove::Celebrate.new, "Celebrate")
|
8
|
+
EmojiTestLove::RSpecFormatter(EmojiTestLove::DrinkingGame.new, "DrinkingGame")
|
9
|
+
EmojiTestLove::RSpecFormatter(EmojiTestLove::DrinkingGameTea.new, "DrinkingGameTea")
|
10
|
+
EmojiTestLove::RSpecFormatter(EmojiTestLove::Fruit.new, "Fruit")
|
11
|
+
EmojiTestLove::RSpecFormatter(EmojiTestLove::Kanpai.new, "Kanpai")
|
12
|
+
EmojiTestLove::RSpecFormatter(EmojiTestLove::LifeHearts.new, "LifeHearts")
|
13
|
+
EmojiTestLove::RSpecFormatter(EmojiTestLove::Lucky.new, "Lucky")
|
14
|
+
EmojiTestLove::RSpecFormatter(EmojiTestLove::Omkase.new, "Omkase")
|
15
|
+
EmojiTestLove::RSpecFormatter(EmojiTestLove::SmileDip.new, "SmileDip")
|
16
|
+
EmojiTestLove::RSpecFormatter(EmojiTestLove::Smiles.new, "SmileyFaces")
|
17
|
+
EmojiTestLove::RSpecFormatter(EmojiTestLove::Sunshine.new, "Sunshine")
|
18
|
+
EmojiTestLove::RSpecFormatter(EmojiTestLove::Thumbs.new, "Thumbs")
|
19
|
+
EmojiTestLove::RSpecFormatter(EmojiTestLove::Turtles.new, "Turtles")
|
20
|
+
EmojiTestLove::RSpecFormatter(EmojiTestLove::Waddles.new, "Waddles")
|
21
|
+
EmojiTestLove::RSpecFormatter(EmojiTestLove::ZenSmiles.new, "ZenSmiles")
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'rspec/core/formatters/base_text_formatter'
|
2
|
+
|
3
|
+
module EmojiTestLove
|
4
|
+
|
5
|
+
class RSpecIntegration < ::RSpec::Core::Formatters::BaseTextFormatter
|
6
|
+
class << self
|
7
|
+
attr_reader :display_provider, :known_formatters
|
8
|
+
|
9
|
+
def display_provider=(provider)
|
10
|
+
@display_provider = provider
|
11
|
+
end
|
12
|
+
|
13
|
+
def inherited(subclass)
|
14
|
+
@known_formatters ||= []
|
15
|
+
@known_formatters << subclass
|
16
|
+
end
|
17
|
+
|
18
|
+
def names
|
19
|
+
Array(display_provider.names) << name
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def display_provider
|
24
|
+
self.class.display_provider
|
25
|
+
end
|
26
|
+
|
27
|
+
def print(display)
|
28
|
+
output.print display
|
29
|
+
end
|
30
|
+
|
31
|
+
def example_passed(example)
|
32
|
+
super(example)
|
33
|
+
self.print success_color display_provider.passed_display
|
34
|
+
end
|
35
|
+
|
36
|
+
def example_failed(example)
|
37
|
+
super(example)
|
38
|
+
self.print failure_color display_provider.failed_display
|
39
|
+
end
|
40
|
+
|
41
|
+
def example_pending(example)
|
42
|
+
super(example)
|
43
|
+
self.print pending_color display_provider.pending_display
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.RSpecFormatter(display_provider, formatter_name = display_provider.class.name)
|
48
|
+
base = new_formatter display_provider
|
49
|
+
formatter_name, namespaces = *split_by_namespace(formatter_name)
|
50
|
+
scope = ensure_namespace_exists namespaces
|
51
|
+
formatter_class_name = "%sFormatter"%formatter_name
|
52
|
+
|
53
|
+
scope.const_set(formatter_class_name, base)
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def self.split_by_namespace(formatter_name)
|
59
|
+
namespaces = formatter_name.split('::')
|
60
|
+
[namespaces.pop, namespaces]
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.new_formatter(delegator)
|
64
|
+
Class.new(RSpecIntegration).tap{ |base| base.display_provider = delegator }
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.ensure_namespace_exists(namespaces)
|
68
|
+
namespaces.inject(self) do |scope, name|
|
69
|
+
scope.const_set(name, Module.new) unless scope.const_defined?(name, false)
|
70
|
+
|
71
|
+
scope.const_get(name, false)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|