Sha256: 1ea94f0290b39b4203752375d4f2008ba88d064b3143887a35f151782b0839e8

Contents?: true

Size: 1.01 KB

Versions: 27

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'

RSpec.describe TypeStation::Content do
  subject {TypeStation::Content.new(name: :title, type: :text)}
  it { should validate_presence_of(:name) }
  it { should validate_presence_of(:type) }

  describe 'Text' do
    before do
      @content = TypeStation::Content.new(name: :title, type: :text)
    end

    it 'will return my simple text' do
      @content.set('My Test')
      expect(@content.get).to eq('My Test')
    end
  end


  describe 'Multiple Select' do
    before do
      @content = TypeStation::Content.new(name: :title, type: :multiple_select)
      @content2 = TypeStation::Content.new(name: :title, type: :multiple_select)
    end

    it 'will return an array from string' do
      @content.set('My Test')
      @content2.set('My Test, Test 2')
      expect(@content.get).to eq(['My Test'])
      expect(@content2.get).to eq(['My Test', 'Test 2'])
    end

    it 'will return an array from array' do
      @content.set(['My Test'])
      expect(@content.get).to eq(['My Test'])
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
type_station-0.7.0 spec/models/type_station/content_spec.rb
type_station-0.6.0 spec/models/type_station/content_spec.rb
type_station-0.5.4 spec/models/type_station/content_spec.rb
type_station-0.5.3 spec/models/type_station/content_spec.rb
type_station-0.5.2 spec/models/type_station/content_spec.rb
type_station-0.5.1 spec/models/type_station/content_spec.rb
type_station-0.4.7 spec/models/type_station/content_spec.rb
type_station-0.4.6 spec/models/type_station/content_spec.rb
type_station-0.4.5 spec/models/type_station/content_spec.rb
type_station-0.4.4 spec/models/type_station/content_spec.rb
type_station-0.4.3 spec/models/type_station/content_spec.rb
type_station-0.4.2 spec/models/type_station/content_spec.rb
type_station-0.4.1 spec/models/type_station/content_spec.rb
type_station-0.4.0 spec/models/type_station/content_spec.rb
type_station-0.3.4 spec/models/type_station/content_spec.rb
type_station-0.3.3 spec/models/type_station/content_spec.rb
type_station-0.3.2 spec/models/type_station/content_spec.rb
type_station-0.3.1 spec/models/type_station/content_spec.rb
type_station-0.3.0 spec/models/type_station/content_spec.rb
type_station-0.2.3 spec/models/type_station/content_spec.rb