Sha256: dfc4476de32587ca703120c2abe3f1cc896d42e24204fd16abf10565ceda45d8

Contents?: true

Size: 660 Bytes

Versions: 14

Compression:

Stored size: 660 Bytes

Contents

require 'spec_helper'

module Qbrick
  describe Setting, type: :model do
    before do
      create(:setting)
      create(:setting, key: 'stuff', value: nil)
    end

    describe '[](key)' do
      context 'setting exists' do
        it 'returns the set value' do
          expect(Setting[:code]).to eq('SomeValue')
        end

        it 'returns empty string for empty setting' do
          expect(Setting[:stuff]).to eq('')
        end
      end

      context "setting doesn't exist" do
        it 'returns empty string for a call on a non-present setting' do
          expect(Setting[:does_not_exist]).to eq('')
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
qbrick-2.6.10 spec/models/setting_spec.rb
qbrick-2.6.9 spec/models/setting_spec.rb
qbrick-2.6.8 spec/models/setting_spec.rb
qbrick-2.6.7 spec/models/setting_spec.rb
qbrick-2.6.6 spec/models/setting_spec.rb
qbrick-2.6.5 spec/models/setting_spec.rb
qbrick-2.6.4 spec/models/setting_spec.rb
qbrick-2.6.3 spec/models/setting_spec.rb
qbrick-2.6.2 spec/models/setting_spec.rb
qbrick-2.6.1 spec/models/setting_spec.rb
qbrick-2.6.0 spec/models/setting_spec.rb
qbrick-2.5.2 spec/models/setting_spec.rb
qbrick-2.5.1 spec/models/setting_spec.rb
qbrick-2.5.0 spec/models/setting_spec.rb