konacha 3.2.3 → 3.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1afb8df0992f3b70332b4d70dec0e010aeeb419
4
- data.tar.gz: 1274256f717c45d44da37716998f82777260ae0c
3
+ metadata.gz: ab4c0793bf058462bd228a1bc1d8b4cdd17ad53c
4
+ data.tar.gz: 998084e6c20558f96d810d6628b1e7a68cd06142
5
5
  SHA512:
6
- metadata.gz: f391e5374c6106275cc3f13effd9572a9916dd01193e106f6f4a5f7a7a411dd1244831f85975c7ae96b7c9f8ec94d4fda26f7b9a317d2b3be5479303ad18442b
7
- data.tar.gz: 2ec43e22ce158e9cbbc4ebffb48b1902d85643c24e78e991eef111c850bed72b033d13b4e25ba38934dca4f0ed26858f35cb83edfead36b55c878cdf75d8c361
6
+ metadata.gz: a5ecc759609c4649018a094f177892dd003d6f15a6fcc61871a9eca22b09d2956d9a76ba9be6a4d1d552de3feda2a5ce4b82516885094394fe9bbeb0605fd5d0
7
+ data.tar.gz: 02c621f71b179ebbec470e7ec420ff0d261213f6b1df54023304685807e829dd9028f4f8428c505edd76d7026bc58af43f6fb74f18d5bfec48e6a82d91a68ced
data/History.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # master
2
2
 
3
+ # 3.2.4
4
+
5
+ * Only use colors when output is a tty (#179)
6
+
3
7
  # 3.2.3
4
8
 
5
9
  * Rails 4.1 compatibility (#178)
@@ -17,7 +17,7 @@ the asset pipeline and engines.}
17
17
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
18
  gem.name = "konacha"
19
19
  gem.require_paths = ["lib"]
20
- gem.version = "3.2.3"
20
+ gem.version = "3.2.4"
21
21
  gem.license = "MIT"
22
22
 
23
23
  gem.add_dependency "railties", ">= 3.1", "< 5"
@@ -15,17 +15,17 @@ module Konacha
15
15
 
16
16
  def example_passed(example)
17
17
  @examples << example
18
- io.write(".".green)
18
+ io.write(with_color('.', :green))
19
19
  end
20
20
 
21
21
  def example_failed(example)
22
22
  @examples << example
23
- io.write("F".red)
23
+ io.write(with_color('F', :red))
24
24
  end
25
25
 
26
26
  def example_pending(example)
27
27
  @examples << example
28
- io.write("P".yellow)
28
+ io.write(with_color('P', :yellow))
29
29
  end
30
30
 
31
31
  def example_group_finished(group); end
@@ -74,7 +74,16 @@ module Konacha
74
74
  end
75
75
 
76
76
  def pending_message(example)
77
- " Pending: #{example.full_description}".yellow
77
+ with_color(" Pending: #{example.full_description}", :yellow)
78
+ end
79
+
80
+ def color_enabled?
81
+ io.tty?
82
+ end
83
+
84
+ def with_color(text, color)
85
+ return text unless color_enabled?
86
+ text.colorize(color)
78
87
  end
79
88
  end
80
89
  end
@@ -9,11 +9,18 @@ describe Konacha::Formatter do
9
9
  subject.send(method, nil)
10
10
  subject.examples.should be_present
11
11
  end
12
-
12
+
13
13
  it "outputs the dot" do
14
14
  subject.send(method, nil)
15
15
  io.rewind
16
- io.read.should include(dot)
16
+ io.read.should eql(dot)
17
+ end
18
+
19
+ it "uses colors when tty" do
20
+ io.stub(:tty?).and_return(true)
21
+ subject.send(method, nil)
22
+ io.rewind
23
+ io.read.should match(/\e\[0;\d{2};49m#{dot}\e\[0m/)
17
24
  end
18
25
  end
19
26
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: konacha
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.3
4
+ version: 3.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Firebaugh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-24 00:00:00.000000000 Z
11
+ date: 2014-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties