test/lib/vedeu/colours/colour_test.rb in vedeu-0.2.11 vs test/lib/vedeu/colours/colour_test.rb in vedeu-0.2.12

- old
+ new

@@ -2,19 +2,26 @@ module Vedeu describe Colour do - describe '#initialize' do - it 'returns an instance of itself' do - attributes = {} + let(:described) { Colour.new(attributes) } + let(:attributes) { + { + background: '', + foreground: '' + } + } - Colour.new(attributes).must_be_instance_of(Colour) - end + describe '#initialize' do + it { return_type_for(described, Colour) } + it { assigns(described, '@attributes', attributes) } end describe '#background' do + it { return_type_for(described.background, String) } + it 'returns an escape sequence' do Colour.new({ background: '#000000' }).background.must_equal("\e[48;2;0;0;0m") end @@ -23,10 +30,12 @@ Colour.new.background.must_equal('') end end describe '#foreground' do + it { return_type_for(described.foreground, String) } + it 'returns an escape sequence' do Colour.new({ foreground: '#ff0000' }).foreground.must_equal("\e[38;2;255;0;0m") end @@ -35,9 +44,11 @@ Colour.new.foreground.must_equal('') end end describe '#to_s' do + it { return_type_for(described.to_s, String) } + it 'returns an escape sequence' do Colour.new({ foreground: '#ff0000', background: '#000000' }).to_s.must_equal("\e[38;2;255;0;0m\e[48;2;0;0;0m")