Sha256: 262ab2ef52b8f010fd44bdbf54b086f17ecc38cb7965117e9cd68dc3e7524ded

Contents?: true

Size: 761 Bytes

Versions: 6

Compression:

Stored size: 761 Bytes

Contents

require 'spec_helper'

describe UserPreferences::Defaults do
  subject(:defaults) { UserPreferences::Defaults.new(UserPreferences.definitions) }

  describe '.get' do
    it 'returns the default preference state' do
      expect(defaults.get).to eq(
        {
          hobbies: {
            outdoors: true,
            cultural: false
          },
          food: {
            vegetarian: false,
            a_la_carte: true,
            courses: 2,
            wine: 'red'
          }
        }
      )
    end

    context 'a category is supplied' do
      it 'returns the default preference state for the category' do
        expect(defaults.get(:hobbies)).to eq({
          outdoors: true,
          cultural: false
        })
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
user_preferences-1.0.2 spec/user_preferences/defaults_spec.rb
user_preferences-1.0.1 spec/user_preferences/defaults_spec.rb
user_preferences-1.0.0 spec/user_preferences/defaults_spec.rb
user_preferences-0.0.3 spec/user_preferences/defaults_spec.rb
user_preferences-0.0.2 spec/user_preferences/defaults_spec.rb
user_preferences-0.0.1 spec/user_preferences/defaults_spec.rb