Sha256: 0508eb50d837d5c4217ee166d6b375c73f22a7a701807b754f01391830154311

Contents?: true

Size: 1.49 KB

Versions: 5

Compression:

Stored size: 1.49 KB

Contents

require 'spec_helper'

describe Alchemy::Admin::LanguagesController do

  before do
    authorize_user(:as_admin)
  end

  describe "#new" do
    context "when default_language.page_layout is set" do
      before do
        allow(Alchemy::Config).to receive(:get) do |arg|
          if arg == :default_language
            {'page_layout' => "new_standard"}
          else
            Alchemy::Config.show[arg.to_s]
          end
        end
      end

      it "uses it as page_layout-default for the new language" do
        alchemy_get :new
        expect(assigns(:language).page_layout).to eq("new_standard")
      end
    end

    context "when default_language is not configured" do
      before do
        allow(Alchemy::Config).to receive(:get) do |arg|
          if arg == :default_language
            nil
          else
            Alchemy::Config.show[arg.to_s]
          end
        end
      end

      it "falls back to default database value." do
        alchemy_get :new
        expect(assigns(:language).page_layout).to eq("intro")
      end
    end

    context "when default language page_layout is not configured" do
      before do
        allow(Alchemy::Config).to receive(:get) do |arg|
          if arg == :default_language
            {}
          else
            Alchemy::Config.show[arg.to_s]
          end
        end
      end

      it "falls back to default database value." do
        alchemy_get :new
        expect(assigns(:language).page_layout).to eq("intro")
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
alchemy_cms-3.2.1 spec/controllers/admin/languages_controller_spec.rb
lc_alchemy_cms-3.2.1 spec/controllers/admin/languages_controller_spec.rb
lc_alchemy_cms-3.2.0 spec/controllers/admin/languages_controller_spec.rb
alchemy_cms-3.2.0 spec/controllers/admin/languages_controller_spec.rb
alchemy_cms-3.2.0.rc1 spec/controllers/admin/languages_controller_spec.rb