Sha256: ba0acaceff3b0b641e9d795acf21692093c24654aa76f569dbfa5bb7e6351801

Contents?: true

Size: 2 KB

Versions: 24

Compression:

Stored size: 2 KB

Contents

require 'spec_helper'

describe Locomotive::Steam::Site do

  let(:attributes) { {} }
  let(:site) { described_class.new(attributes) }

  describe '#handle' do

    let(:attributes) { { handle: 'acme' } }

    subject { site.handle }
    it { is_expected.to eq 'acme' }

    context 'from a subdomain if the handle property is nil' do

      let(:attributes) { { subdomain: 'acme' } }
      it { is_expected.to eq 'acme' }

    end

  end

  describe '#locales' do

    subject { site.locales }

    context 'without locales' do
      it { is_expected.to eq [:en] }
    end

    context 'with locales' do

      let(:attributes) { { locales: %w(en fr) } }
      it { is_expected.to eq [:en, :fr] }

    end

  end

  describe '#default_locale' do

    subject { site.default_locale }

    context 'without locales' do
      it { is_expected.to eq :en }
    end

    context 'with locales' do

      let(:attributes) { { locales: %w(en fr) } }
      it { is_expected.to eq :en }

    end

  end

  describe '#timezone_name' do

    subject { site.timezone_name }
    it { is_expected.to eq 'UTC' }

    context 'not blank' do

      let(:attributes) { { timezone: 'CDT' } }
      it { is_expected.to eq 'CDT' }

    end

    context 'from the timezone_name attribute itself' do

      let(:attributes) { { timezone_name: 'CDT' } }
      it { is_expected.to eq 'CDT' }

    end

  end

  describe '#last_modified_at' do

    subject { site.last_modified_at }

    it { is_expected.to eq nil }

    context 'only updated_at is defined' do

      let(:attributes) { { updated_at: DateTime.parse('2015/10/16 00:00:00') } }
      it { is_expected.to eq DateTime.parse('2015/10/16 00:00:00') }

    end

    context 'template_version or content_version are defined' do

      let(:attributes) { { updated_at: DateTime.parse('2015/10/16 00:00:00'), template_version: DateTime.parse('2007/06/29 00:00:00'), content_version: DateTime.parse('2009/09/10 00:00:00') } }
      it { is_expected.to eq DateTime.parse('2009/09/10 00:00:00') }

    end

  end

end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
locomotivecms_steam-1.3.0.rc2 spec/unit/entities/site_spec.rb
locomotivecms_steam-1.1.2 spec/unit/entities/site_spec.rb
locomotivecms_steam-1.2.1 spec/unit/entities/site_spec.rb
locomotivecms_steam-1.3.0.rc1 spec/unit/entities/site_spec.rb
locomotivecms_steam-1.2.0 spec/unit/entities/site_spec.rb
locomotivecms_steam-1.2.0.rc3 spec/unit/entities/site_spec.rb
locomotivecms_steam-1.2.0.rc2 spec/unit/entities/site_spec.rb
locomotivecms_steam-1.2.0.rc1 spec/unit/entities/site_spec.rb
locomotivecms_steam-1.2.0.beta1 spec/unit/entities/site_spec.rb
locomotivecms_steam-1.1.1 spec/unit/entities/site_spec.rb
locomotivecms_steam-1.1.0 spec/unit/entities/site_spec.rb
locomotivecms_steam-1.1.0.rc3 spec/unit/entities/site_spec.rb
locomotivecms_steam-1.1.0.rc2 spec/unit/entities/site_spec.rb
locomotivecms_steam-1.1.0.rc1 spec/unit/entities/site_spec.rb
locomotivecms_steam-1.0.1 spec/unit/entities/site_spec.rb
locomotivecms_steam-1.0.0 spec/unit/entities/site_spec.rb
locomotivecms_steam-1.0.0.rc10 spec/unit/entities/site_spec.rb
locomotivecms_steam-1.0.0.rc9 spec/unit/entities/site_spec.rb
locomotivecms_steam-1.0.0.rc8 spec/unit/entities/site_spec.rb
locomotivecms_steam-1.0.0.rc6 spec/unit/entities/site_spec.rb