Sha256: 431b2597c188d6d3f54e5e5ecf5a54018077164ce1658a9915abb1f5dc0a290a

Contents?: true

Size: 952 Bytes

Versions: 16

Compression:

Stored size: 952 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

describe Lcms::Engine::Settings do
  it 'has valid factory' do
    expect(build :setting).to be_valid
  end

  describe 'storage for settings by keys' do
    let(:key) { :editing_enabled }
    let(:default_value) { true }
    let(:value) { 'value' }

    it 'creates initial settings for specified key' do
      expect(Lcms::Engine::Settings[key]).to eq default_value
    end

    it 'reads the settings by keys' do
      Lcms::Engine::Settings[:test] # to initiate empty settings
      Lcms::Engine::Settings.last.update data: { key => value }
      expect(Lcms::Engine::Settings[key]).to eq value
    end

    it 'writes settings by keys' do
      Lcms::Engine::Settings[key] = value
      expect(Lcms::Engine::Settings[key]).to eq value
    end

    it 'raises an error if unknown method is called' do
      expect { Lcms::Engine::Settings.fake }.to raise_error NoMethodError
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
lcms-engine-0.5.5 spec/models/settings_spec.rb
lcms-engine-0.5.4 spec/models/settings_spec.rb
lcms-engine-0.5.3 spec/models/settings_spec.rb
lcms-engine-0.5.2 spec/models/settings_spec.rb
lcms-engine-0.5.1 spec/models/settings_spec.rb
lcms-engine-0.5.0 spec/models/settings_spec.rb
lcms-engine-0.4.2 spec/models/settings_spec.rb
lcms-engine-0.4.1 spec/models/settings_spec.rb
lcms-engine-0.4.0 spec/models/settings_spec.rb
lcms-engine-0.3.1 spec/models/settings_spec.rb
lcms-engine-0.1.4 spec/models/settings_spec.rb
lcms-engine-0.3.0 spec/models/settings_spec.rb
lcms-engine-0.1.3 spec/models/settings_spec.rb
lcms-engine-0.2.0 spec/models/settings_spec.rb
lcms-engine-0.1.2 spec/models/settings_spec.rb
lcms-engine-0.1.0 spec/models/settings_spec.rb