colorable 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,53 +1,67 @@
1
1
  require_relative 'spec_helper'
2
2
 
3
3
  describe Colorable do
4
- describe "String#to_color" do
5
- context "apply a colorname string" do
6
- subject { "Lime Green".to_color }
7
- it { should be_instance_of Colorable::Color }
8
- its(:to_s) { should eql "Lime Green" }
9
- end
10
-
11
- context "apply a hex string" do
12
- subject { "#32CD32".to_color }
13
- it { should be_instance_of Colorable::Color }
14
- its(:to_s) { should eql "#32CD32" }
15
- end
16
-
17
- context "apply a invalid string" do
18
- it "raise ArgumentError" do
19
- expect { "Bad Green".to_color }.to raise_error ArgumentError
20
- end
21
- end
22
- end
23
-
24
- describe "Symbol#to_color" do
25
- context "apply a colorname symbol" do
26
- subject { :lime_green.to_color }
27
- it { should be_instance_of Colorable::Color }
28
- its(:to_s) { should eql "Lime Green" }
29
- end
30
-
31
- context "apply a invalid symbol" do
32
- it "raise ArgumentError" do
33
- expect { :bad_green.to_color }.to raise_error ArgumentError
34
- end
35
- end
36
- end
37
-
38
- describe "Array#to_color" do
39
- context "apply a RGB values" do
40
- subject { [50, 205, 50].to_color }
41
- it { should be_instance_of Colorable::Color }
42
- its(:to_s) { should eql "rgb(50,205,50)" }
43
- end
44
-
45
- context "apply a invalid array" do
46
- it "raise ArgumentError" do
47
- expect { [50, 205].to_color }.to raise_error ArgumentError
48
- expect { [50, 205, 300].to_color }.to raise_error ArgumentError
49
- expect { ['50', '205', '205'].to_color }.to raise_error ArgumentError
50
- end
51
- end
52
- end
4
+ describe "String#to_color" do
5
+ context "apply a colorname string" do
6
+ subject { "Lime Green".to_color }
7
+ it { should be_instance_of Colorable::Color }
8
+ its(:to_s) { should eql "Lime Green" }
9
+ end
10
+
11
+ context "apply a hex string" do
12
+ subject { "#32CD32".to_color }
13
+ it { should be_instance_of Colorable::Color }
14
+ its(:to_s) { should eql "#32CD32" }
15
+ end
16
+
17
+ context "apply a invalid string" do
18
+ it "raise ArgumentError" do
19
+ expect { "Bad Green".to_color }.to raise_error ArgumentError
20
+ end
21
+ end
22
+ end
23
+
24
+ describe "Symbol#to_color" do
25
+ context "apply a colorname symbol" do
26
+ subject { :lime_green.to_color }
27
+ it { should be_instance_of Colorable::Color }
28
+ its(:to_s) { should eql "Lime Green" }
29
+ end
30
+
31
+ context "apply a invalid symbol" do
32
+ it "raise ArgumentError" do
33
+ expect { :bad_green.to_color }.to raise_error ArgumentError
34
+ end
35
+ end
36
+ end
37
+
38
+ describe "Array#to_color" do
39
+ context "apply a RGB values" do
40
+ subject { [50, 205, 50].to_color }
41
+ it { should be_instance_of Colorable::Color }
42
+ its(:to_s) { should eql "rgb(50,205,50)" }
43
+ end
44
+
45
+ context "apply a invalid array" do
46
+ it "raise ArgumentError" do
47
+ expect { [50, 205].to_color }.to raise_error ArgumentError
48
+ expect { [50, 205, 300].to_color }.to raise_error ArgumentError
49
+ expect { ['50', '205', '205'].to_color }.to raise_error ArgumentError
50
+ end
51
+ end
52
+ end
53
+
54
+ describe "Fixnum#to_color" do
55
+ context "apply a hex Fixnum" do
56
+ subject { 0x32CD32.to_color }
57
+ it { should be_instance_of Colorable::Color }
58
+ its(:to_s) { should eql "#32CD32" }
59
+ end
60
+
61
+ context "apply a invalid Fixnum" do
62
+ it "raise ArgumentError" do
63
+ expect { 323232.to_color }.to raise_error ArgumentError
64
+ end
65
+ end
66
+ end
53
67
  end
@@ -88,7 +88,7 @@ describe Colorset do
88
88
 
89
89
  describe "#to_s" do
90
90
  before(:all) { @cs = Colorset.new }
91
- it { @cs.to_s.should eql "#<Colorset 0/144 pos='Alice Blue/rgb(240,248,255)/hsb(208,6,100)'>"}
92
- it { @cs.next;@cs.to_s.should eql "#<Colorset 1/144 pos='Antique White/rgb(250,235,215)/hsb(35,14,98)'>"}
91
+ it { @cs.to_s.should eql "#<Colorable::Colorset 0/144 pos='Alice Blue<rgb(240,248,255)/hsb(208,6,100)>'>"}
92
+ it { @cs.next;@cs.to_s.should eql "#<Colorable::Colorset 1/144 pos='Antique White<rgb(250,235,215)/hsb(35,14,98)>'>"}
93
93
  end
94
94
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: colorable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kyoendo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-10 00:00:00.000000000 Z
11
+ date: 2013-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec