Sha256: f5398c99309e1a09b9698aff58d8ef9b534c5498976c865e5eec3b7f6fa1ff8a

Contents?: true

Size: 667 Bytes

Versions: 7

Compression:

Stored size: 667 Bytes

Contents

require 'spec_helper'

RSpec.describe NsSettingsUi::SettingsHelper, type: :helper do
  describe '.setting_value_class' do
    let(:setting) { NsSettingsUi::Setting.make!(key: 'matching.cluster_size', value: value, default_value: '5') }

    subject { helper.setting_value_class(setting) }

    context 'when value is empty' do
      let(:value) { '' }

      it { is_expected.to eq('alert-danger') }
    end

    context 'when value is different than default' do
      let(:value) { '10' }

      it { is_expected.to eq('alert-warning') }
    end

    context 'when value is default' do
      let(:value) { '5' }

      it { is_expected.to eq('') }
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ns_settings_ui-1.5.2 spec/helpers/ns_settings_ui/settings_helper_spec.rb
ns_settings_ui-1.5.1 spec/helpers/ns_settings_ui/settings_helper_spec.rb
ns_settings_ui-1.4.0 spec/helpers/ns_settings_ui/settings_helper_spec.rb
ns_settings_ui-1.3.0 spec/helpers/ns_settings_ui/settings_helper_spec.rb
ns_settings_ui-1.2.0 spec/helpers/ns_settings_ui/settings_helper_spec.rb
ns_settings_ui-1.1.0 spec/helpers/ns_settings_ui/settings_helper_spec.rb
ns_settings_ui-1.0.0 spec/helpers/ns_settings_ui/settings_helper_spec.rb