Sha256: 6ee11e2804527f15546202d6429f61bdfc2be4be9112a46c900d4fd45eb07cdf

Contents?: true

Size: 1.25 KB

Versions: 20

Compression:

Stored size: 1.25 KB

Contents

# encoding: utf-8

require 'spec_helper'

require 'active_support'
require 'active_support/core_ext'
require 'locomotive/wagon/commands/pull_sub_commands/pull_base_command'
require 'locomotive/wagon/commands/pull_sub_commands/pull_content_types_command'

describe Locomotive::Wagon::PullContentTypesCommand do

  let(:locales) { ['en'] }
  let(:site)    { instance_double('Site', locales: locales) }
  let(:command) { described_class.new(nil, site, nil) }

  describe '#select_options_yaml' do

    subject { command.send(:select_options_yaml, options) }

    context 'the site is localized' do

      let(:locales) { ['en', 'fr'] }
      let(:options) { [{ 'id' => '1', 'name' => { 'en' => 'team', 'fr' => 'équipe' }, 'position' => 2 }, { 'id' => '2', 'name' => { 'en' => 'accounting', 'fr' => 'compta' }, 'position' => 1 }] }

      it { expect(subject['en']).to eq(['accounting', 'team']) }
      it { expect(subject['fr']).to eq(['compta', 'équipe']) }

    end

    context 'the site is not localized' do

      let(:locales) { ['fr'] }
      let(:options) { [{ 'id' => '1', 'name' => { 'fr' => 'équipe' }, 'position' => 2 }, { 'id' => '2', 'name' => {'fr' => 'compta' }, 'position' => 1 }] }

      it { is_expected.to eq(['compta', 'équipe']) }

    end

  end

end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
locomotivecms_wagon-3.0.0 spec/unit/commands/pull_sub_commands/pull_content_types_command_spec.rb
locomotivecms_wagon-3.0.0.rc0 spec/unit/commands/pull_sub_commands/pull_content_types_command_spec.rb
locomotivecms_wagon-3.0.0.beta2 spec/unit/commands/pull_sub_commands/pull_content_types_command_spec.rb
locomotivecms_wagon-2.4.1 spec/unit/commands/pull_sub_commands/pull_content_types_command_spec.rb
locomotivecms_wagon-2.4.0 spec/unit/commands/pull_sub_commands/pull_content_types_command_spec.rb
locomotivecms_wagon-2.4.0.rc2 spec/unit/commands/pull_sub_commands/pull_content_types_command_spec.rb
locomotivecms_wagon-2.4.0.rc1 spec/unit/commands/pull_sub_commands/pull_content_types_command_spec.rb
locomotivecms_wagon-2.3.0 spec/unit/commands/pull_sub_commands/pull_content_types_command_spec.rb
locomotivecms_wagon-2.3.0.rc1 spec/unit/commands/pull_sub_commands/pull_content_types_command_spec.rb
locomotivecms_wagon-2.2.0 spec/unit/commands/pull_sub_commands/pull_content_types_command_spec.rb
locomotivecms_wagon-2.2.0.rc3 spec/unit/commands/pull_sub_commands/pull_content_types_command_spec.rb
locomotivecms_wagon-2.2.0.rc2 spec/unit/commands/pull_sub_commands/pull_content_types_command_spec.rb
locomotivecms_wagon-2.2.0.rc1 spec/unit/commands/pull_sub_commands/pull_content_types_command_spec.rb
locomotivecms_wagon-2.2.0.beta1 spec/unit/commands/pull_sub_commands/pull_content_types_command_spec.rb
locomotivecms_wagon-2.1.1 spec/unit/commands/pull_sub_commands/pull_content_types_command_spec.rb
locomotivecms_wagon-2.1.0 spec/unit/commands/pull_sub_commands/pull_content_types_command_spec.rb
locomotivecms_wagon-2.1.0.rc5 spec/unit/commands/pull_sub_commands/pull_content_types_command_spec.rb
locomotivecms_wagon-2.1.0.rc4 spec/unit/commands/pull_sub_commands/pull_content_types_command_spec.rb
locomotivecms_wagon-2.1.0.rc3 spec/unit/commands/pull_sub_commands/pull_content_types_command_spec.rb
locomotivecms_wagon-2.0.1 spec/unit/commands/pull_sub_commands/pull_content_types_command_spec.rb