colorable 0.0.8 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,43 +1,24 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
1
+ require_relative 'spec_helper'
2
2
 
3
3
  include Colorable::Converter
4
4
  describe Colorable::Converter do
5
5
  let(:conv) { Colorable::Converter }
6
6
  describe "#name2rgb" do
7
- context "when name exsist" do
8
- it "return a RGB value" do
9
- name2rgb("Alice Blue").should eql [240, 248, 255]
10
- name2rgb("Khaki").should eql [240, 230, 140]
11
- name2rgb("Mint Cream").should eql [245, 255, 250]
12
- name2rgb("Thistle").should eql [216, 191, 216]
13
- end
14
- end
15
-
16
- context "when name not exist" do
17
- it "raise NoNameError" do
18
- expect { name2rgb("Hello Yellow") }.to raise_error conv::NoNameError
19
- end
7
+ it "return a RGB value" do
8
+ name2rgb("Alice Blue").should eql [240, 248, 255]
9
+ name2rgb("Khaki").should eql [240, 230, 140]
10
+ name2rgb("Mint Cream").should eql [245, 255, 250]
11
+ name2rgb("Thistle").should eql [216, 191, 216]
12
+ name2rgb("Hello Yellow").should be_nil
20
13
  end
21
14
  end
22
15
 
23
16
  describe "#rgb2name" do
24
- context "when name exist" do
25
- it "returns a name" do
26
- rgb2name([240, 248, 255]).should eql "Alice Blue"
27
- rgb2name([216, 191, 216]).should eql "Thistle"
28
- end
29
- end
30
-
31
- context "when name not exist" do
32
- it "returns nil" do
33
- rgb2name([240, 240, 240]).should be_nil
34
- end
35
- end
36
-
37
- context "when invalid rgb" do
38
- it "raise ArgumentError" do
39
- expect { rgb2name([0, 260, 0]) }.to raise_error ArgumentError
40
- end
17
+ it "returns a name" do
18
+ rgb2name([240, 248, 255]).should eql "Alice Blue"
19
+ rgb2name([216, 191, 216]).should eql "Thistle"
20
+ rgb2name([0, 260, 0]).should be_nil
21
+ rgb2name([240, 240, 240]).should be_nil
41
22
  end
42
23
  end
43
24
 
@@ -51,8 +32,8 @@ describe Colorable::Converter do
51
32
  end
52
33
 
53
34
  context "when a invalid rgb" do
54
- it "raise ArgumentError" do
55
- expect { rgb2hsb([100, 100, -10]) }.to raise_error ArgumentError
35
+ it "not raise ArgumentError" do
36
+ expect { rgb2hsb([100, 100, -10]) }.not_to raise_error ArgumentError
56
37
  end
57
38
  end
58
39
  end
@@ -67,10 +48,10 @@ describe Colorable::Converter do
67
48
  end
68
49
 
69
50
  context "when a invalid hsb" do
70
- it "raise ArgumentError" do
71
- expect { hsb2rgb([-100, 50, 50]) }.to raise_error ArgumentError
72
- expect { hsb2rgb([350, 101, 50]) }.to raise_error ArgumentError
73
- expect { hsb2rgb([0, 50, -50]) }.to raise_error ArgumentError
51
+ it "not raise ArgumentError" do
52
+ expect { hsb2rgb([-100, 50, 50]) }.not_to raise_error ArgumentError
53
+ expect { hsb2rgb([350, 101, 50]) }.not_to raise_error ArgumentError
54
+ expect { hsb2rgb([0, 50, -50]) }.not_to raise_error ArgumentError
74
55
  end
75
56
  end
76
57
  end
@@ -85,8 +66,8 @@ describe Colorable::Converter do
85
66
  end
86
67
 
87
68
  context "when a invalid rgb" do
88
- it "raise ArgumentError" do
89
- expect { rgb2hex([100, 100, -10]) }.to raise_error ArgumentError
69
+ it "not raise ArgumentError" do
70
+ expect { rgb2hex([100, 100, -10]) }.not_to raise_error ArgumentError
90
71
  end
91
72
  end
92
73
  end
@@ -101,9 +82,9 @@ describe Colorable::Converter do
101
82
  end
102
83
 
103
84
  context "when a invalid hex" do
104
- it "raise ArgumentError" do
105
- expect { hex2rgb('#FFFFFG') }.to raise_error ArgumentError
106
- expect { hex2rgb('$FFFFFG') }.to raise_error ArgumentError
85
+ it "not raise ArgumentError" do
86
+ expect { hex2rgb('#FFFFFG') }.not_to raise_error ArgumentError
87
+ expect { hex2rgb('$FFFFFG') }.not_to raise_error ArgumentError
107
88
  end
108
89
  end
109
90
  end
@@ -119,8 +100,8 @@ describe Colorable::Converter do
119
100
  end
120
101
 
121
102
  context "when a invalid rgb" do
122
- it "raise ArgumentError" do
123
- expect { rgb2hsb([100, 100, -10]) }.to raise_error ArgumentError
103
+ it "not raise ArgumentError" do
104
+ expect { rgb2hsb([100, 100, -10]) }.not_to raise_error ArgumentError
124
105
  end
125
106
  end
126
107
  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.0.8
4
+ version: 0.1.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-04-30 00:00:00.000000000 Z
11
+ date: 2013-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -40,10 +40,12 @@ files:
40
40
  - colorable.gemspec
41
41
  - lib/colorable.rb
42
42
  - lib/colorable/color.rb
43
+ - lib/colorable/color_space.rb
43
44
  - lib/colorable/colorset.rb
44
45
  - lib/colorable/converter.rb
45
46
  - lib/colorable/system_extension.rb
46
47
  - lib/colorable/version.rb
48
+ - spec/color_space_spec.rb
47
49
  - spec/color_spec.rb
48
50
  - spec/colorset_spec.rb
49
51
  - spec/converter_spec.rb
@@ -73,6 +75,7 @@ specification_version: 4
73
75
  summary: A simple color handler which provide a conversion between colorname, RGB,
74
76
  HSB and HEX
75
77
  test_files:
78
+ - spec/color_space_spec.rb
76
79
  - spec/color_spec.rb
77
80
  - spec/colorset_spec.rb
78
81
  - spec/converter_spec.rb