Sha256: 25e9d3b77ba2498724fe60c75bbdd89c9a6ba510888003d3512aacf8f4e6f21b

Contents?: true

Size: 689 Bytes

Versions: 18

Compression:

Stored size: 689 Bytes

Contents

require 'spec_helper'

module Alchemy
  describe EssenceDate do
    let(:essence) { EssenceDate.new }

    it_behaves_like "an essence" do
      let(:essence)          { EssenceDate.new }
      let(:ingredient_value) { DateTime.now }
    end

    describe '#preview_text' do
      context "if no date set" do
        it "should return an empty string" do
          expect(essence.preview_text).to eq("")
        end
      end

      context "if date set" do
        it "should format the date by i18n" do
          essence.date = DateTime.now
          expect(::I18n).to receive(:l).with(essence.date, format: :date)
          essence.preview_text
        end
      end
    end

  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

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