Sha256: be5ffc407b18fce24fe921e52eca287e47861afbbcddd144f89b73efc0a34fb1

Contents?: true

Size: 1.08 KB

Versions: 18

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe 'alchemy/essences/_essence_date_view' do
  let(:essence) { Alchemy::EssenceDate.new(date: '2013-10-27 21:14:16 +0100'.to_datetime) }
  let(:content) { Alchemy::Content.new(essence: essence) }
  let(:options) { {} }

  before do
    allow(view).to receive(:options).and_return(options)
  end

  context "with date value" do
    context 'without date_format passed' do
      it "translates the date value with default format" do
        render content, content: content
        expect(rendered).to have_content('Sun, 27 Oct 2013 20:14:16 +0000')
      end
    end

    context 'with option date_format set to rfc822' do
      let(:options) { {date_format: 'rfc822'} }

      it "renders the date rfc822 conform" do
        render content, content: content
        expect(rendered).to have_content('Sun, 27 Oct 2013 20:14:16 +0000')
      end
    end
  end

  context 'with blank date value' do
    let(:essence) { Alchemy::EssenceDate.new(date: nil) }

    it "renders nothing" do
      render content, content: content
      expect(rendered).to eq('')
    end
  end

end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
alchemy_cms-3.2.1 spec/views/essences/essence_date_view_spec.rb
alchemy_cms-3.1.3 spec/views/essences/essence_date_view_spec.rb
lc_alchemy_cms-3.2.1 spec/views/essences/essence_date_view_spec.rb
lc_alchemy_cms-3.2.0 spec/views/essences/essence_date_view_spec.rb
alchemy_cms-3.2.0 spec/views/essences/essence_date_view_spec.rb
alchemy_cms-3.2.0.rc1 spec/views/essences/essence_date_view_spec.rb
alchemy_cms-3.2.0.beta spec/views/essences/essence_date_view_spec.rb
alchemy_cms-3.1.1 spec/views/essences/essence_date_view_spec.rb
alchemy_cms-3.1.0 spec/views/essences/essence_date_view_spec.rb
alchemy_cms-3.1.0.rc3 spec/views/essences/essence_date_view_spec.rb
alchemy_cms-3.1.0.rc2 spec/views/essences/essence_date_view_spec.rb
alchemy_cms-3.1.0.rc1 spec/views/essences/essence_date_view_spec.rb
alchemy_cms-3.1.0.beta6 spec/views/essences/essence_date_view_spec.rb
alchemy_cms-3.1.0.beta5 spec/views/essences/essence_date_view_spec.rb
alchemy_cms-3.1.0.beta4 spec/views/essences/essence_date_view_spec.rb
alchemy_cms-3.1.0.beta3 spec/views/essences/essence_date_view_spec.rb
alchemy_cms-3.1.0.beta2 spec/views/essences/essence_date_view_spec.rb
alchemy_cms-3.1.0.beta1 spec/views/essences/essence_date_view_spec.rb