mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-30 21:27:17 +00:00
28 lines
641 B
Ruby
28 lines
641 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'spec_helper'
|
|
|
|
describe Spree::Preferences::Configuration do
|
|
before :all do
|
|
class AppConfig < Spree::Preferences::Configuration
|
|
preference :color, :string, default: :blue
|
|
end
|
|
@config = AppConfig.new
|
|
end
|
|
|
|
it "has named methods to access preferences" do
|
|
@config.color = 'orange'
|
|
expect(@config.color).to eq 'orange'
|
|
end
|
|
|
|
it "uses [ ] to access preferences" do
|
|
@config[:color] = 'red'
|
|
expect(@config[:color]).to eq 'red'
|
|
end
|
|
|
|
it "uses set/get to access preferences" do
|
|
@config.set :color, 'green'
|
|
expect(@config.get(:color)).to eq 'green'
|
|
end
|
|
end
|