Sha256: 4a97eb6db0727ee50bb68855eb3f60c387eddefe188e5ad9df3565dfd2aeab7d

Contents?: true

Size: 1.46 KB

Versions: 7

Compression:

Stored size: 1.46 KB

Contents

require 'spec_helper'

describe Alchemy::Admin::LanguagesController do

  before do
    sign_in(admin_user)
  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
        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
        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
        get :new
        expect(assigns(:language).page_layout).to eq("intro")
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
alchemy_cms-3.1.3 spec/controllers/admin/languages_controller_spec.rb
alchemy_cms-3.1.1 spec/controllers/admin/languages_controller_spec.rb
alchemy_cms-3.1.0 spec/controllers/admin/languages_controller_spec.rb
alchemy_cms-3.1.0.rc3 spec/controllers/admin/languages_controller_spec.rb
alchemy_cms-3.1.0.rc2 spec/controllers/admin/languages_controller_spec.rb
alchemy_cms-3.1.0.rc1 spec/controllers/admin/languages_controller_spec.rb
alchemy_cms-3.1.0.beta6 spec/controllers/admin/languages_controller_spec.rb