Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo on class Error #227

Merged
merged 1 commit into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/rails-settings/base.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module RailsSettings
class ProcetedKeyError < RuntimeError
class ProtectedKeyError < RuntimeError
def initialize(key)
super("Can't use #{key} as setting key.")
end
Expand Down Expand Up @@ -87,7 +87,7 @@ def readonly_keys
def _define_field(key, default: nil, type: :string, readonly: false, separator: nil, validates: nil, **opts)
key = key.to_s

raise ProcetedKeyError.new(key) if PROTECTED_KEYS.include?(key)
raise ProtectedKeyError.new(key) if PROTECTED_KEYS.include?(key)

@defined_fields ||= []
@defined_fields << {
Expand Down
4 changes: 2 additions & 2 deletions test/base_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ def assert_record_value(var, val)
end

test "define setting with protected keys" do
assert_raise(RailsSettings::ProcetedKeyError, "Can't use var as setting key.") do
assert_raise(RailsSettings::ProtectedKeyError, "Can't use var as setting key.") do
class NewSetting < RailsSettings::Base
field :var
end
end

assert_raise(RailsSettings::ProcetedKeyError, "Can't use value as setting key.") do
assert_raise(RailsSettings::ProtectedKeyError, "Can't use value as setting key.") do
class NewSetting < RailsSettings::Base
field :value
end
Expand Down