Sha256: 401db843d8aa68bdba35429c8cae4df1c9df78fdba187947ee275f42d50a6d5f

Contents?: true

Size: 829 Bytes

Versions: 17

Compression:

Stored size: 829 Bytes

Contents

require 'spec_helper'
require 'fedux_org/stdlib/colors/html_color'

describe FeduxOrg::Stdlib::Colors::HtmlColor do
  context '#valid?' do

    it 'suceeds if string is valid html color' do
      expect( 
             FeduxOrg::Stdlib::Colors::HtmlColor.new( '#11aa11' ).valid?
            ).to be_true
    end

    it 'fails if color does not start with #' do
      expect( 
             FeduxOrg::Stdlib::Colors::HtmlColor.new( '111111' ).valid?
            ).to be_false
    end

    it 'fails if length is invalid' do
      expect( 
             FeduxOrg::Stdlib::Colors::HtmlColor.new( '#111111111' ).valid?
            ).to be_false
    end

    it 'fails if no hex number is given' do
      expect( 
             FeduxOrg::Stdlib::Colors::HtmlColor.new( '#ZZAAZZ' ).valid?
            ).to be_false
    end
    
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
fedux_org-stdlib-0.3.2 spec/colors/html_color_spec.rb
fedux_org-stdlib-0.3.0 spec/colors/html_color_spec.rb
fedux_org-stdlib-0.2.1 spec/colors/html_color_spec.rb
fedux_org-stdlib-0.1.3 spec/colors/html_color_spec.rb
fedux_org-stdlib-0.1.2 spec/colors/html_color_spec.rb
fedux_org-stdlib-0.1.1 spec/colors/html_color_spec.rb
fedux_org-stdlib-0.1.0 spec/colors/html_color_spec.rb
fedux_org-stdlib-0.0.39 spec/colors/html_color_spec.rb
fedux_org-stdlib-0.0.38 spec/colors/html_color_spec.rb
fedux_org-stdlib-0.0.37 spec/colors/html_color_spec.rb
fedux_org-stdlib-0.0.36 spec/colors/html_color_spec.rb
fedux_org-stdlib-0.0.35 spec/colors/html_color_spec.rb
fedux_org-stdlib-0.0.33 spec/colors/html_color_spec.rb
fedux_org-stdlib-0.0.32 spec/colors/html_color_spec.rb
fedux_org-stdlib-0.0.31 spec/colors/html_color_spec.rb
fedux_org-stdlib-0.0.30 spec/colors/html_color_spec.rb
fedux_org-stdlib-0.0.29 spec/colors/html_color_spec.rb