Sha256: b0c3c176602368eeaa284a684055b4e25a718e6debe4dbfa7cfb95d324880ca9

Contents?: true

Size: 1.48 KB

Versions: 2

Compression:

Stored size: 1.48 KB

Contents

require 'spec_helper'

describe Flms::TextLayer do
  include NamedFactories

  describe 'view_object' do
    it 'provides a view object' do
      expect(Flms::TextLayer.new.view_object.is_a?(Flms::TextLayerViewObject)).to be_true
    end
  end

  describe 'validation' do
    describe 'color' do
      it 'permits 3-digit hex color' do
        text_layer_1a1.update_attribute(:color, '1bc')
        expect(text_layer_1a1.color).to eql '1bc'
      end

      it 'permits 6-digit hex color' do
        text_layer_1a1.update_attribute(:color, 'abcdef')
        expect(text_layer_1a1.color).to eql 'abcdef'
      end

      it 'does not permit non-hex color' do
        text_layer_1a1.update_attribute(:color, 'abadcolorvalue')
        expect(text_layer_1a1).to have(1).error_on(:color)
      end
    end

    describe 'text' do
      it 'does not permit null text' do
        text_layer_1a1.update_attribute(:text, nil)
        expect(text_layer_1a1).to have(1).error_on(:text)
      end
    end

    describe 'font_size' do
      it 'does not permit negative size' do
        text_layer_1a1.update_attribute(:font_size, -1.0)
        expect(text_layer_1a1).to have(1).error_on(:font_size)
      end

      it 'does not permit null size' do
        text_layer_1a1.update_attribute(:font_size, nil)
        expect(text_layer_1a1).to have(1).error_on(:font_size)
      end
    end
  end

  describe 'defaults' do
    it 'sets default font color of fff' do
      expect(subject.color).to eql 'fff'
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flms-0.9.0 spec/models/text_layer_spec.rb
flms-0.1.0 spec/models/text_layer_spec.rb