spec/ase_spec.rb in ase-1.0.3 vs spec/ase_spec.rb in ase-2.0.0
- old
+ new
@@ -29,11 +29,11 @@
expect(palette.colors).to eq({})
end
it "can add and remove colors" do
palette = ASE::Palette.new('Test')
- color = ASE::Color.new(255, 255, 255)
+ color = ASE::Color::RGB.new(255, 255, 255)
palette.add 'White', color
expect(palette.colors).to eq({
'White' => color
})
@@ -42,53 +42,21 @@
expect(palette.colors).to eq({})
end
it '#length returns the number of colors' do
palette = ASE::Palette.new('Test')
- palette.add 'White', ASE::Color.new(255, 255, 255)
- palette.add 'Black', ASE::Color.new(0, 0, 0)
+ palette.add 'White', ASE::Color::RGB.new(255, 255, 255)
+ palette.add 'Black', ASE::Color::RGB.new(0, 0, 0)
expect(palette.length).to be 2
expect(palette.size).to be 2
end
it '#[] lets you access a specific color' do
palette = ASE::Palette.new('Test')
- color = ASE::Color.new(255, 255, 255)
+ color = ASE::Color::RGB.new(255, 255, 255)
palette.add 'White', color
expect(palette['White']).to be color
- end
- end
-
- describe ASE::Color do
- it 'must be initialized with all RGB channels' do
- expect {
- ASE::Color.new
- }.to raise_error
- end
-
- it 'sets a proper default for the alpha channel' do
- color = ASE::Color.new(0, 0, 0)
- expect(color.a).to be 255
- end
-
- it 'can be created with an RGB array' do
- color1 = ASE::Color.from_rgba [0, 0, 0]
- color2 = ASE::Color.from_rgb [0, 0, 0]
-
- expect(color1.to_rgba).to eq([0, 0, 0, 255])
- expect(color2.to_rgba).to eq([0, 0, 0, 255])
- end
-
- it 'can be created from a hex value' do
- color1 = ASE::Color.from_hex('#000000')
- color2 = ASE::Color.from_hex('000000')
- color3 = ASE::Color.from_hex('#00000000')
-
- rgba = [0, 0, 0, 255]
- expect(color1.to_rgba).to eq(rgba)
- expect(color2.to_rgba).to eq(rgba)
- expect(color3.to_rgba).to eq([0, 0, 0, 0])
end
end
end
\ No newline at end of file