mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-06 22:36:07 +00:00
Fix offense constant definition in block in models/spree/preferences/configuration_spec.rb
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
# AllowedMethods: enums
|
||||
Lint/ConstantDefinitionInBlock:
|
||||
Exclude:
|
||||
- 'spec/models/spree/preferences/configuration_spec.rb'
|
||||
- 'spec/models/spree/preferences/preferable_spec.rb'
|
||||
- 'spec/validators/date_time_string_validator_spec.rb'
|
||||
- 'spec/validators/integer_array_validator_spec.rb'
|
||||
|
||||
@@ -3,25 +3,24 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Spree::Preferences::Configuration do
|
||||
before :all do
|
||||
class AppConfig < Spree::Preferences::Configuration
|
||||
let(:config) do
|
||||
Class.new(Spree::Preferences::Configuration) do
|
||||
preference :color, :string, default: :blue
|
||||
end
|
||||
@config = AppConfig.new
|
||||
end.new
|
||||
end
|
||||
|
||||
it "has named methods to access preferences" do
|
||||
@config.color = 'orange'
|
||||
expect(@config.color).to eq 'orange'
|
||||
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'
|
||||
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'
|
||||
config.set :color, 'green'
|
||||
expect(config.get(:color)).to eq 'green'
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user