Adding custom colors to the draw arg

This commit is contained in:
Andy Meneely
2015-07-03 00:47:46 -04:00
parent f16f285a0a
commit 6aecdbbb4a
20 changed files with 188 additions and 142 deletions
+16 -2
View File
@@ -2,7 +2,8 @@ require 'spec_helper'
require 'squib/args/box'
describe Squib::Args::Draw do
subject(:draw) { Squib::Args::Draw.new }
let(:custom_colors) { {'foo' => 'abc'} }
subject(:draw) {Squib::Args::Draw.new(custom_colors)}
context 'unit conversion' do
@@ -43,6 +44,19 @@ describe Squib::Args::Draw do
expect(draw).to have_attributes(dash: [[900, 1200, 1500]])
end
end
context 'custom colors' do
it 'looks up custom colors in the config' do
draw.load!({color: 'foo'})
expect(draw.color).to eq ['abc']
end
it 'passes on through for non-custom color' do
draw = Squib::Args::Draw.new(custom_colors)
draw.load!({color: 'bar'})
expect(draw.color).to eq ['bar']
end
end
end
end