Sha256: 0364f4bd7c2d15240a8871c1c5a2c3470071a4cdff238b15e02ef38ba4310853
Contents?: true
Size: 1.8 KB
Versions: 20
Compression:
Stored size: 1.8 KB
Contents
require 'test_helper' module Vedeu module Colours describe Repository do let(:described) { Vedeu::Colours::Repository } let(:instance) { described.new } let(:storage) { {} } describe '#initialize' do it { instance.must_be_instance_of(described) } it { instance.instance_variable_get('@storage').must_equal(storage) } end describe 'accessors' do it { instance.must_respond_to(:storage) } end describe '#register' do let(:colour) { 'ff0000' } let(:escape_sequence) { 'fake_escape_sequence' } subject { instance.register(colour, escape_sequence) } it { subject.must_equal('fake_escape_sequence') } end describe '#registered?' do let(:colour) {} subject { instance.registered?(colour) } context 'when the colour is registered' do let(:colour) { '#aa0000' } before { instance.register(colour, 'fake_escape_sequence') } it { subject.must_equal(true) } end context 'when the colour is not registered' do it { subject.must_equal(false) } end end describe '#reset!' do subject { instance.reset! } it { subject.must_be_instance_of(Hash) } it { subject.must_equal({}) } end describe '#retrieve' do let(:colour) {} subject { instance.retrieve(colour) } context 'when the colour can be found' do let(:colour) { '#bb0000' } before { instance.register(colour, 'fake_escape_sequence') } it { subject.must_equal('fake_escape_sequence') } end context 'when the colour cannot be found' do it { subject.must_equal('') } end end end # Repository end # Colours end # Vedeu
Version data entries
20 entries across 20 versions & 1 rubygems