Sha256: 3b894b6192d221c7589cee5a7885525b42f827411bf3e446083a44d97ed860b3

Contents?: true

Size: 1.6 KB

Versions: 9

Compression:

Stored size: 1.6 KB

Contents

require 'spec_helper'

module Refinery
  module Core
    describe 'configuration' do
      describe '.site_name' do
        # reset any previously defined site name
        before do
          Refinery::Core.site_name = nil
        end

        context 'when set in configuration' do
          it 'returns name set by Refinery::Core.config' do
            allow(Refinery::Core).to receive(:site_name).and_return('Test Site Name')
            expect(Refinery::Core.site_name).to eq('Test Site Name')
          end
        end

        context 'when set in locale file' do
          before do
            ::I18n.backend.store_translations :en, :refinery => {
              :core => {
                :config => {
                  :site_name => 'I18n Site Name'
                }
              }
            }
          end

          it 'returns name set in locale' do
            expect(Refinery::Core.site_name).to eq('I18n Site Name')
          end
        end
      end

      describe 'custom storage backend' do
        it 'class should be nil by default' do
          expect(Refinery::Core.dragonfly_custom_backend_class).to eq(nil)
        end

        context 'is set in core' do
          before { class DummyBackend; end }
          after { Refinery::Core.dragonfly_custom_backend_class = nil }
          let(:backend) { DummyBackend.new }

          it 'and is set to a class that exists' do
            Refinery::Core.dragonfly_custom_backend_class = 'Refinery::Core::DummyBackend'
            expect(Refinery::Core.dragonfly_custom_backend_class).to eq(backend.class)
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
refinerycms-core-4.0.1 spec/lib/refinery/core/configuration_spec.rb
refinerycms-core-3.0.6 spec/lib/refinery/core/configuration_spec.rb
refinerycms-core-4.0.0 spec/lib/refinery/core/configuration_spec.rb
refinerycms-core-3.0.5 spec/lib/refinery/core/configuration_spec.rb
refinerycms-core-3.0.4 spec/lib/refinery/core/configuration_spec.rb
refinerycms-core-3.0.3 spec/lib/refinery/core/configuration_spec.rb
refinerycms-core-3.0.2 spec/lib/refinery/core/configuration_spec.rb
refinerycms-core-3.0.1 spec/lib/refinery/core/configuration_spec.rb
refinerycms-core-3.0.0 spec/lib/refinery/core/configuration_spec.rb