emoji-rspec 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -15,4 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
- .ruby-version
18
+ .ruby-gemset
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 1.9.3-p392
data/.travis.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 1.8.7
3
4
  - 1.9.2
4
5
  - 1.9.3
data/Rakefile CHANGED
@@ -9,4 +9,4 @@ RSpec::Core::RakeTask.new(:spec) do |task|
9
9
  end
10
10
 
11
11
  desc 'Default: Run specs.'
12
- task default: :spec
12
+ task :default => :spec
@@ -0,0 +1,10 @@
1
+ module Emoji
2
+ module Helper
3
+ module_function
4
+
5
+ def utf8_encode(str)
6
+ [str.to_i(16)].pack("U*")
7
+ end
8
+
9
+ end
10
+ end
@@ -1,3 +1,3 @@
1
1
  Dir[File.join(File.dirname(__FILE__), 'formatters', '*.rb')].each do |file|
2
- require_relative File.join('formatters', File.basename(file, '.rb'))
2
+ require file
3
3
  end
@@ -1,57 +1,30 @@
1
1
  require 'rspec/core/formatters/base_text_formatter'
2
+ require 'emoji/helper'
2
3
 
3
4
  module Emoji
4
5
  module RSpec
5
6
  module Formatters
6
7
 
7
8
  class AdventureTimeFormatter < ::RSpec::Core::Formatters::BaseTextFormatter
8
- PASS_EMOJI = [
9
- "\u{1f496} ",
10
- "\u{1f31f} ",
11
- "\u{2728} ",
12
- "\u{1f4ab} ",
13
- "\u{1f478} ",
14
- "\u{1f471} ",
15
- "\u{1f415} ",
16
- "\u{1f49d} ",
17
- "\u{2b50} ",
18
- ]
9
+ PASS_EMOJI = %w[ 1f496 1f31f 2728 1f4ab 1f478 1f471 1f415 1f49d 2b50 ]
19
10
 
20
- FAIL_EMOJI = [
21
- "\u{1f608} ",
22
- "\u{1f47f} ",
23
- "\u{1f4a5} ",
24
- "\u{1f4a2} ",
25
- "\u{1f479} ",
26
- "\u{1f47a} ",
27
- "\u{1f4a9} ",
28
- "\u{1f432} ",
29
- ]
11
+ FAIL_EMOJI = %w[ 1f608 1f47f 1f4a5 1f4a2 1f479 1f47a 1f4a9 1f432 ]
30
12
 
31
- PEND_EMOJI = [
32
- "\u{1f47d} ",
33
- "\u{1f48a} ",
34
- "\u{1f427} ",
35
- "\u{1f3b2} ",
36
- "\u{1f47e} ",
37
- "\u{1f392} ",
38
- "\u{1f4f1} ",
39
- "\u{1f526} ",
40
- ]
13
+ PEND_EMOJI = %w[ 1f47d 1f48a 1f427 1f3b2 1f47e 1f392 1f4f1 1f526 ]
41
14
 
42
15
  def example_passed(example)
43
16
  super(example)
44
- output.print green rand_emoji PASS_EMOJI
17
+ output.print success_color "#{Emoji::Helper.utf8_encode(rand_emoji PASS_EMOJI)} "
45
18
  end
46
19
 
47
20
  def example_failed(example)
48
21
  super(example)
49
- output.print red rand_emoji FAIL_EMOJI
22
+ output.print failure_color "#{Emoji::Helper.utf8_encode(rand_emoji FAIL_EMOJI)} "
50
23
  end
51
24
 
52
25
  def example_pending(example)
53
26
  super(example)
54
- output.print yellow rand_emoji PEND_EMOJI
27
+ output.print pending_color "#{Emoji::Helper.utf8_encode(rand_emoji PEND_EMOJI)} "
55
28
  end
56
29
 
57
30
  private
@@ -1,4 +1,5 @@
1
1
  require 'rspec/core/formatters/base_text_formatter'
2
+ require 'emoji/helper'
2
3
 
3
4
  module Emoji
4
5
  module RSpec
@@ -7,17 +8,17 @@ module Emoji
7
8
  class AggressiveThumbsFormatter < ::RSpec::Core::Formatters::BaseTextFormatter
8
9
  def example_passed(example)
9
10
  super(example)
10
- output.print green "\u{1f44c} "
11
+ output.print success_color "#{Emoji::Helper.utf8_encode('1f44c')} "
11
12
  end
12
13
 
13
14
  def example_failed(example)
14
15
  super(example)
15
- output.print red "\u{1f44a} "
16
+ output.print failure_color "#{Emoji::Helper.utf8_encode('1f44a')} "
16
17
  end
17
18
 
18
19
  def example_pending(example)
19
20
  super(example)
20
- output.print yellow "\u{270a} "
21
+ output.print pending_color "#{Emoji::Helper.utf8_encode('270a')} "
21
22
  end
22
23
  end
23
24
 
@@ -1,4 +1,5 @@
1
1
  require 'rspec/core/formatters/base_text_formatter'
2
+ require 'emoji/helper'
2
3
 
3
4
  module Emoji
4
5
  module RSpec
@@ -7,17 +8,17 @@ module Emoji
7
8
  class DrinkingGameFormatter < ::RSpec::Core::Formatters::BaseTextFormatter
8
9
  def example_passed(example)
9
10
  super(example)
10
- output.print green "\u{2615} "
11
+ output.print success_color "#{Emoji::Helper.utf8_encode('2615')} "
11
12
  end
12
13
 
13
14
  def example_failed(example)
14
15
  super(example)
15
- output.print red "\u{1f378} "
16
+ output.print failure_color "#{Emoji::Helper.utf8_encode('1f378')} "
16
17
  end
17
18
 
18
19
  def example_pending(example)
19
20
  super(example)
20
- output.print yellow "\u{1f37a} "
21
+ output.print pending_color "#{Emoji::Helper.utf8_encode('1f37a')} "
21
22
  end
22
23
  end
23
24
 
@@ -1,4 +1,5 @@
1
1
  require 'rspec/core/formatters/base_text_formatter'
2
+ require 'emoji/helper'
2
3
 
3
4
  module Emoji
4
5
  module RSpec
@@ -7,17 +8,17 @@ module Emoji
7
8
  class DrinkingGameTeaFormatter < ::RSpec::Core::Formatters::BaseTextFormatter
8
9
  def example_passed(example)
9
10
  super(example)
10
- output.print green "\u{1f375} "
11
+ output.print success_color "#{Emoji::Helper.utf8_encode('1f375')} "
11
12
  end
12
13
 
13
14
  def example_failed(example)
14
15
  super(example)
15
- output.print red "\u{1f378} "
16
+ output.print failure_color "#{Emoji::Helper.utf8_encode('1f378')} "
16
17
  end
17
18
 
18
19
  def example_pending(example)
19
20
  super(example)
20
- output.print yellow "\u{1f37a} "
21
+ output.print pending_color "#{Emoji::Helper.utf8_encode('1f37a')} "
21
22
  end
22
23
  end
23
24
 
@@ -1,4 +1,5 @@
1
1
  require 'rspec/core/formatters/base_text_formatter'
2
+ require 'emoji/helper'
2
3
 
3
4
  module Emoji
4
5
  module RSpec
@@ -7,17 +8,17 @@ module Emoji
7
8
  class LifeHeartsFormatter < ::RSpec::Core::Formatters::BaseTextFormatter
8
9
  def example_passed(example)
9
10
  super(example)
10
- output.print green "\u{1f49a} "
11
+ output.print success_color "#{Emoji::Helper.utf8_encode('1f49a')} "
11
12
  end
12
13
 
13
14
  def example_failed(example)
14
15
  super(example)
15
- output.print red "\u{1f494} "
16
+ output.print failure_color "#{Emoji::Helper.utf8_encode('1f494')} "
16
17
  end
17
18
 
18
19
  def example_pending(example)
19
20
  super(example)
20
- output.print yellow "\u{1f49b} "
21
+ output.print pending_color "#{Emoji::Helper.utf8_encode('1f49b')} "
21
22
  end
22
23
  end
23
24
 
@@ -1,4 +1,5 @@
1
1
  require 'rspec/core/formatters/base_text_formatter'
2
+ require 'emoji/helper'
2
3
 
3
4
  module Emoji
4
5
  module RSpec
@@ -7,17 +8,17 @@ module Emoji
7
8
  class SmilesFormatter < ::RSpec::Core::Formatters::BaseTextFormatter
8
9
  def example_passed(example)
9
10
  super(example)
10
- output.print green "\u{1f60a} "
11
+ output.print success_color "#{Emoji::Helper.utf8_encode('1f60a')} "
11
12
  end
12
13
 
13
14
  def example_failed(example)
14
15
  super(example)
15
- output.print red "\u{1f621} "
16
+ output.print failure_color "#{Emoji::Helper.utf8_encode('1f621')} "
16
17
  end
17
18
 
18
19
  def example_pending(example)
19
20
  super(example)
20
- output.print yellow "\u{1f62c} "
21
+ output.print pending_color "#{Emoji::Helper.utf8_encode('1f62c')} "
21
22
  end
22
23
  end
23
24
 
@@ -1,4 +1,5 @@
1
1
  require 'rspec/core/formatters/base_text_formatter'
2
+ require 'emoji/helper'
2
3
 
3
4
  module Emoji
4
5
  module RSpec
@@ -7,17 +8,17 @@ module Emoji
7
8
  class ThumbsFormatter < ::RSpec::Core::Formatters::BaseTextFormatter
8
9
  def example_passed(example)
9
10
  super(example)
10
- output.print green "\u{1f44d} "
11
+ output.print success_color "#{Emoji::Helper.utf8_encode('1f44d')} "
11
12
  end
12
13
 
13
14
  def example_failed(example)
14
15
  super(example)
15
- output.print red "\u{1f44e} "
16
+ output.print failure_color "#{Emoji::Helper.utf8_encode('1f44e')} "
16
17
  end
17
18
 
18
19
  def example_pending(example)
19
20
  super(example)
20
- output.print yellow "\u{270b} "
21
+ output.print pending_color "#{Emoji::Helper.utf8_encode('270b')} "
21
22
  end
22
23
  end
23
24
 
@@ -1,4 +1,5 @@
1
1
  require 'rspec/core/formatters/base_text_formatter'
2
+ require 'emoji/helper'
2
3
 
3
4
  module Emoji
4
5
  module RSpec
@@ -7,17 +8,17 @@ module Emoji
7
8
  class ZenSmilesFormatter < ::RSpec::Core::Formatters::BaseTextFormatter
8
9
  def example_passed(example)
9
10
  super(example)
10
- output.print green "\u{1f610} "
11
+ output.print success_color "#{Emoji::Helper.utf8_encode('1f610')} "
11
12
  end
12
13
 
13
14
  def example_failed(example)
14
15
  super(example)
15
- output.print red "\u{1f61e} "
16
+ output.print failure_color "#{Emoji::Helper.utf8_encode('1f61e')} "
16
17
  end
17
18
 
18
19
  def example_pending(example)
19
20
  super(example)
20
- output.print yellow "\u{1f614} "
21
+ output.print pending_color "#{Emoji::Helper.utf8_encode('1f614')} "
21
22
  end
22
23
  end
23
24
 
@@ -1,5 +1,5 @@
1
1
  module Emoji
2
2
  module RSpec
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -0,0 +1,40 @@
1
+ # encoding: utf-8
2
+ require 'emoji-rspec'
3
+
4
+ describe Emoji::RSpec::Formatters::LifeHeartsFormatter do
5
+
6
+ let(:output) { StringIO.new }
7
+ let(:formatter) { Emoji::RSpec::Formatters::LifeHeartsFormatter.new(output) }
8
+ let(:example) { double "example 1" }
9
+
10
+ describe "custom_colors" do
11
+ it "uses the custom success color" do
12
+ RSpec.configure do |config|
13
+ config.color_enabled = true
14
+ config.tty = true
15
+ config.success_color = :cyan
16
+ end
17
+
18
+ formatter.example_passed example
19
+ expect(output.string).to include("\e[36m")
20
+ end
21
+ end
22
+
23
+ describe "utf8 encoding" do
24
+ it "converts the passing example" do
25
+ formatter.example_passed example
26
+ expect(output.string).to include("💚 ")
27
+ end
28
+
29
+ it "converts the failing example" do
30
+ formatter.example_failed example
31
+ expect(output.string).to include("💔 ")
32
+ end
33
+
34
+ it "converts the pending example" do
35
+ formatter.example_pending example
36
+ expect(output.string).to include("💛 ")
37
+ end
38
+ end
39
+
40
+ end
metadata CHANGED
@@ -1,72 +1,77 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: emoji-rspec
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.1
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 2
10
+ version: 0.0.2
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Aaron Kromer
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-11-28 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2013-05-19 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: rspec
16
- requirement: !ruby/object:Gem::Requirement
22
+ version_requirements: &id001 !ruby/object:Gem::Requirement
17
23
  none: false
18
- requirements:
24
+ requirements:
19
25
  - - ~>
20
- - !ruby/object:Gem::Version
21
- version: '2.10'
22
- type: :runtime
26
+ - !ruby/object:Gem::Version
27
+ hash: 23
28
+ segments:
29
+ - 2
30
+ - 10
31
+ version: "2.10"
23
32
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ~>
28
- - !ruby/object:Gem::Version
29
- version: '2.10'
30
- - !ruby/object:Gem::Dependency
33
+ type: :runtime
34
+ requirement: *id001
35
+ - !ruby/object:Gem::Dependency
31
36
  name: rspec
32
- requirement: !ruby/object:Gem::Requirement
37
+ version_requirements: &id002 !ruby/object:Gem::Requirement
33
38
  none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
38
- type: :development
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ hash: 3
43
+ segments:
44
+ - 0
45
+ version: "0"
39
46
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
- - !ruby/object:Gem::Dependency
47
+ type: :development
48
+ requirement: *id002
49
+ - !ruby/object:Gem::Dependency
47
50
  name: rake
48
- requirement: !ruby/object:Gem::Requirement
51
+ version_requirements: &id003 !ruby/object:Gem::Requirement
49
52
  none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- type: :development
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ hash: 3
57
+ segments:
58
+ - 0
59
+ version: "0"
55
60
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
61
+ type: :development
62
+ requirement: *id003
62
63
  description: Custom formatters for RSpec tests.
63
64
  email:
64
65
  executables: []
66
+
65
67
  extensions: []
68
+
66
69
  extra_rdoc_files: []
67
- files:
70
+
71
+ files:
68
72
  - .gitignore
69
73
  - .rspec
74
+ - .ruby-version
70
75
  - .travis.yml
71
76
  - Gemfile
72
77
  - LICENSE.txt
@@ -74,6 +79,7 @@ files:
74
79
  - Rakefile
75
80
  - emoji-rspec.gemspec
76
81
  - lib/emoji-rspec.rb
82
+ - lib/emoji/helper.rb
77
83
  - lib/emoji/rspec/formatters.rb
78
84
  - lib/emoji/rspec/formatters/adventure_time_formatter.rb
79
85
  - lib/emoji/rspec/formatters/aggressive_thumbs_formatter.rb
@@ -85,31 +91,39 @@ files:
85
91
  - lib/emoji/rspec/formatters/zen_smiles_formatter.rb
86
92
  - lib/emoji/rspec/integration.rb
87
93
  - lib/emoji/rspec/version.rb
88
- - spec/spec_helper.rb
94
+ - spec/example_formatter_spec.rb
89
95
  homepage: https://github.com/cupakromer/emoji-rspec
90
- licenses:
96
+ licenses:
91
97
  - MIT
92
98
  post_install_message:
93
99
  rdoc_options: []
94
- require_paths:
100
+
101
+ require_paths:
95
102
  - lib
96
- required_ruby_version: !ruby/object:Gem::Requirement
103
+ required_ruby_version: !ruby/object:Gem::Requirement
97
104
  none: false
98
- requirements:
99
- - - ! '>='
100
- - !ruby/object:Gem::Version
101
- version: '0'
102
- required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ hash: 3
109
+ segments:
110
+ - 0
111
+ version: "0"
112
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
113
  none: false
104
- requirements:
105
- - - ! '>='
106
- - !ruby/object:Gem::Version
107
- version: '0'
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ hash: 3
118
+ segments:
119
+ - 0
120
+ version: "0"
108
121
  requirements: []
122
+
109
123
  rubyforge_project:
110
- rubygems_version: 1.8.24
124
+ rubygems_version: 1.8.25
111
125
  signing_key:
112
126
  specification_version: 3
113
127
  summary: Emoji RSpec Formatters
114
- test_files:
115
- - spec/spec_helper.rb
128
+ test_files:
129
+ - spec/example_formatter_spec.rb
data/spec/spec_helper.rb DELETED
File without changes