Sha256: 014217672fbf92b34a4781408df5dd94702a0cb29f1d6bcd4dce7218c8727693

Contents?: true

Size: 1.24 KB

Versions: 47

Compression:

Stored size: 1.24 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Spree::Admin::BaseHelper, type: :helper do
  include Spree::Admin::BaseHelper

  context "#datepicker_field_value" do
    it "should return nil when date is empty" do
      date = nil
      expect(datepicker_field_value(date)).to be_nil
    end

    it "should return a formatted date when date is present" do
      date = "2013-08-14".to_time
      expect(datepicker_field_value(date)).to eq("2013/08/14")
    end
  end

  describe "#admin_layout" do
    subject { admin_layout(value) }

    context "when no initial value has been set" do
      context "and an argument is sent" do
        let(:value) { "full-width" }
        it { is_expected.to eq "full-width" }
      end

      context "and no argument is sent" do
        let(:value) { nil }
        it { is_expected.to be_nil }
      end
    end

    context "when an initial value is set" do
      before { admin_layout("full-width") }

      context "and it is called again without an argument" do
        let(:value) { nil }
        it { is_expected.to eq "full-width" }
      end

      context "and it is called again with an argument" do
        let(:value) { "centered" }
        it { is_expected.to eq "centered" }
      end
    end
  end
end

Version data entries

47 entries across 47 versions & 2 rubygems

Version Path
solidus_backend-2.10.5 spec/helpers/admin/base_helper_spec.rb
solidus_backend-2.10.3 spec/helpers/admin/base_helper_spec.rb
solidus_backend-2.10.2 spec/helpers/admin/base_helper_spec.rb
solidus_backend-2.9.6 spec/helpers/admin/base_helper_spec.rb
solidus_backend-2.8.6 spec/helpers/admin/base_helper_spec.rb
solidus_backend-2.10.1 spec/helpers/admin/base_helper_spec.rb
solidus_backend-2.9.5 spec/helpers/admin/base_helper_spec.rb
solidus_backend-2.10.0 spec/helpers/admin/base_helper_spec.rb
solidus_backend-2.9.4 spec/helpers/admin/base_helper_spec.rb
solidus_backend-2.6.6 spec/helpers/admin/base_helper_spec.rb
solidus_backend-2.7.4 spec/helpers/admin/base_helper_spec.rb
solidus_backend-2.8.5 spec/helpers/admin/base_helper_spec.rb
solidus_backend-2.9.3 spec/helpers/admin/base_helper_spec.rb
solidus_backend-2.9.2 spec/helpers/admin/base_helper_spec.rb
solidus_backend-2.10.0.beta1 spec/helpers/admin/base_helper_spec.rb
solidus_backend-2.7.3 spec/helpers/admin/base_helper_spec.rb
solidus_backend-2.6.5 spec/helpers/admin/base_helper_spec.rb
solidus_backend-2.9.1 spec/helpers/admin/base_helper_spec.rb
solidus_backend-2.9.0 spec/helpers/admin/base_helper_spec.rb
solidus_backend-2.9.0.rc.1 spec/helpers/admin/base_helper_spec.rb