Sha256: 9e23ed0dd5fdfce980043d349bf79741e3dbc4c3e3d392bb1278a7843d111fda
Contents?: true
Size: 1.47 KB
Versions: 2
Compression:
Stored size: 1.47 KB
Contents
# frozen_string_literal: true require 'test_helper' module Vedeu module Colours describe Validator do let(:described) { Vedeu::Colours::Validator } let(:instance) { described.new(_value) } let(:_value) {} describe '#initialize' do it { instance.must_be_instance_of(described) } it { instance.instance_variable_get('@value').must_equal(_value) } end describe '.valid?' do subject { described.valid?(_value) } context 'when the value is a HTML/CSS formatted hexidecimal string' do let(:_value) { '#654321' } it { subject.must_equal(true) } end context 'when the value is a Vedeu::Colours::Background' do let(:_value) { Vedeu::Colours::Background.new('#654321') } it { subject.must_equal(true) } end context 'when the value is a Vedeu::Colours::Colour' do let(:_value) { Vedeu::Colours::Colour.new } it { subject.must_equal(true) } end context 'when the value is a Vedeu::Colours::Foreground' do let(:_value) { Vedeu::Colours::Foreground.new('#654321') } it { subject.must_equal(true) } end context 'when the value is invalid' do let(:_value) { '#123' } it { subject.must_equal(false) } end end describe '#valid?' do it { instance.must_respond_to(:valid?) } end end # Validator end # Colours end # Vedeu
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.8.2 | test/lib/vedeu/colours/validator_test.rb |
vedeu-0.8.1 | test/lib/vedeu/colours/validator_test.rb |